Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Receiver Socket Timeout when No Data is Received #199

Open
barlowd55 opened this issue Mar 12, 2023 · 9 comments · May be fixed by #200
Open

Set Receiver Socket Timeout when No Data is Received #199

barlowd55 opened this issue Mar 12, 2023 · 9 comments · May be fixed by #200

Comments

@barlowd55
Copy link

I use an encoder that streams on the multicast port which is consumed through your app and re-streams to customers.

There is one issue I faced. Sometimes the source on the encoder may be down. The port may be active but does not send any data.

When such an instance happens, the app goes in an infinite loop to receive the data on the port.

Is there a possibility to set a timeout on the receiver to close the connection for the client, instead of looping continuously.

@n-thumann
Copy link
Owner

Thank you for your suggestion! Sounds like a good idea to me.
What do you think a reasonable timeout would be? Maybe 30 seconds?

@n-thumann n-thumann linked a pull request Mar 13, 2023 that will close this issue
@n-thumann n-thumann linked a pull request Mar 13, 2023 that will close this issue
@n-thumann
Copy link
Owner

@barlowd55 do you want to give #200 a try? 😊

@barlowd55
Copy link
Author

Thanks for the feature. I tried out the timeout option, but what I can see is that the client does not disconnect. It just keeps on trying to establish a connection and the app simply disconnects the connection.

My client app keeps polling trying to establish a connection but does not close the connection. Eventually the client times out with 500 error.

Is there a possibility to close the client connection, maybe by sending the correct header code or by calling the socket close function.

@barlowd55
Copy link
Author

Commenting on the same issue, this is the error I get on console:

(node:877710) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:530:11)
    at ServerResponse.header (/root/restream/node_modules/express/lib/response.js:794:10)
    at ServerResponse.contentType (/root/restream/node_modules/express/lib/response.js:624:15)
    at ServerResponse.send (/root/restream/node_modules/express/lib/response.js:149:14)
    at /root/restream/dist/routes/live.js:38:25
(node:877710) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:877710) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Not sure, but after some time, the code exists node app.

@vuducdong
Copy link

vuducdong commented Jun 22, 2024

How to fix this error? @n-thumann

Error: Failed to lookup view "stations" in views directory "/views"
    at Function.render (/app/node_modules/express/lib/application.js:597:17)
    at ServerResponse.render (/app/node_modules/express/lib/response.js:1039:7)
    at /app/routes/station.js:13:9
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/app/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/app/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at /app/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/app/node_modules/express/lib/router/index.js:346:12)
    at next (/app/node_modules/express/lib/router/index.js:280:10)

or

Error: Failed to lookup view "status" in views directory "/views"
    at Function.render (/app/node_modules/express/lib/application.js:597:17)
    at ServerResponse.render (/app/node_modules/express/lib/response.js:1039:7)
    at /app/routes/status.js:11:9
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/app/node_modules/express/lib/router/route.js:144:13)
    at Route.dispatch (/app/node_modules/express/lib/router/route.js:114:3)
    at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
    at /app/node_modules/express/lib/router/index.js:284:15
    at Function.process_params (/app/node_modules/express/lib/router/index.js:346:12)
    at next (/app/node_modules/express/lib/router/index.js:280:10)

Thanks!

@n-thumann
Copy link
Owner

Is is possible that you're running an outdated version of IPTV-ReStream? This is a known issue (#238), but I've fixed it in https://github.com/n-thumann/IPTV-ReStream/releases/tag/v1.5.0.

@vuducdong
Copy link

vuducdong commented Jun 23, 2024

Is is possible that you're running an outdated version of IPTV-ReStream? This is a known issue (#238), but I've fixed it in https://github.com/n-thumann/IPTV-ReStream/releases/tag/v1.5.0.

ok, it's my fault, I got the source from docker hub (still not updated to the latest version)

image

But my ISP provide iptv through vlan, so here just format is needed, for example: rtp://@232.84.1.117:10254

is there to watch live

image

while the multicastadressliste.json file requires media_multicast_sourceip to be filled in.

Can I customize?

For example, with updxy, I'm watching live like this
image

Thank you so much and Have a nice day!

@n-thumann
Copy link
Owner

But my ISP provide iptv through vlan, so here just format is needed, for example: rtp://@232.84.1.117:10254

VLANs are beyond the control of an application. Looks are you have a RTP multicast address, but without a specific source.

while the multicastadressliste.json file requires media_multicast_sourceip to be filled in.
Can I customize?

For the missing multicast source IP, one option would be to figure out (e.g. by inspecting the traffic with Wireshark) what the actual source IP is and use that one.
If that's not possible, feel free to adjust the code in a fork. For my side, I would prefer to keep the source IP mandatory, because this app is intended for source specific multicast :)

@vuducdong
Copy link

But my ISP provide iptv through vlan, so here just format is needed, for example: rtp://@232.84.1.117:10254

VLANs are beyond the control of an application. Looks are you have a RTP multicast address, but without a specific source.

while the multicastadressliste.json file requires media_multicast_sourceip to be filled in.

Can I customize?

For the missing multicast source IP, one option would be to figure out (e.g. by inspecting the traffic with Wireshark) what the actual source IP is and use that one.

If that's not possible, feel free to adjust the code in a fork. For my side, I would prefer to keep the source IP mandatory, because this app is intended for source specific multicast :)

Ok, thank you for your support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants