-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Eventing Websocket connection time if destination is not available #2734
Comments
Using libwebsocket 4.1-stable branch just to have it mentioned |
Not strictly related to your changes, but the I noticed that the issue happens only on lws >= 3.2. |
As a side note I've tested the minimal lws server example and CTRL-C immediately stops the process. |
Thanks @atoppi for stepping into it. |
You may want to investigate this yourself as well, in the meanwhile. As Alessandro said, it doesn't happen with the example they provide, so looking at the differences from more POV would help. |
On the PR, probably better to wait until the issue is solved, as otherwise from what I've understood it wouldn't be usable due to the long timeout anyway, is that correct? |
If i compare the websocket sample they do nothing in the lws_service loop and handle the connecting completely in dedicated scheduler callbacks (lws_sul_schedule) I will check if thats a working approach cause i was already playing around with all the initialization parameters without any effect. Looks like if the websocket is not connected the lws_service is just internally ideling... |
Yes, you need to "wake up" the loop using |
here is the commit |
Nice finding, but for the eventing websocket i dont see it solving the problem. I wonder as all the implementations i find concerning the libwebsocket do nothing in the lws_service loop so i would implement it based on the sample. handle the connect with dedicated callbacks from the scheduler and let the loop just do the lws_service. I would adopt the PR in that direction if you are not currently investigate in that direction. |
The examples use |
i will have that in mind...... so up to 3.2 connect attempt out of the service loop |
No need, we fixed it already. Commit to come. |
k, standing by, if you touch it please check the maximum duration a reconnect may take. |
The above commit fixes the issue for us. |
Will check if it fixes the startup issue of the two servers. Thanks. |
The lws_service still sleeps for 25 seconds. the janus shutdown is fixed, it returns from lws_service due to the lws_cancel.
|
I can not reproduce the issue anymore. Please try again with a clean install. |
these are the logs from a janus instance with enabled ws ev handler (and upstream ws server not started)
|
strange, which libwebsocket is being used? |
lws 4.2 |
Found it: I will play a bit and see if the connect is established if the server starts while he is waiting for the connect. |
Good catch. |
fyi there are a couple of references to timeout settings in a lws client example here |
I already played around with those timer values yesterday but did not get a proper result. I have it not working with the approach from the samples using the lws_sul_schedule and leaving the lws_service on it´s own. That looks promising. |
Looks promising. But due to the change with the scheduler a bit refactored. [Thu Jul 15 13:32:10 2021] [WARN] WebSocketsEventHandler: Error attempting connection... (next retry in 1s) |
Hi @lminiero
hi MeetEcho team
as you were complaining about not receiving PRs (At least @fippo told me so ;] ) from our side i am finally stepping into the code.
Actually i wanted to improve something super trivial but in the end my lack of knowledge in libwebsocket hinders me to really make a PR out of it but i provide the code.
We are using Janus as SFU and have an own signalling server upfront.
In order to get everything up and running is thus start janus in advance the the signalling server.
The problem is that it then takes time until janus is able to setup the outbound eventing websocket connection to our signalling server as in the initial startup the connect fails. In the end leading that leads to a total delay of additional 30 seconds to get a new deployed server up an running.
Furthermore if the connection attempt fails janus is always doubling the time for a reconnect which makes it kind of ugly to develop. If the signalling server is not running for 10 minutes i need to wait several minutes for janus to reconnect or i restart janus.
Thus the code tries to solve two things:
master...JanFellner:feature/CC-2166-make-eventing-websocket-reconnect-time-configurable
The issue i have is that lws_service always blocks for about 25 seconds. I added diagnostic code that shows the issue:
The text was updated successfully, but these errors were encountered: