-
Notifications
You must be signed in to change notification settings - Fork 33
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
sse client not receiving any messages. #17
Comments
Do you mean that it suddenly stops receiving any messages? Do you have dumps of the event stream sent by server? Is it possible that the client "chokes" on a particular event that triggers and bug and leads to it getting stuck? |
I don't see any issue in the server side logs, also the client side received messages are the regular message. There is no error as well it just that client connection is in ESTABLISHED state. Restarting server is not making the client to reconnect to the server at all. |
The client doesn't automatically reconnect because that's not necessarily the behavior that the user wants. If you want that behavior, you can detect when the |
But when server restart, client should reconnect to server isn't it? Usually, when I restart server, sse client reconnects but sometimes it just freezes and doesn't reconnect. Any thought? |
Any recommendation for how to detect that the generators stops? |
If the connection is severed, the while not really_done_with_it:
client = connect_or_reconnect(last_received)
for event in client.events():
# deal with the event and return false as long as we expect more
really_done_with_it = deal_with_it(event) |
Ok thanks for the psuedo-code... that is similar to the code I have. I am interfacing with the nest api... I believe it's maintaining the connection but it stops sending the keep alive events and they expect me to break the connection. I suspect this is the way nest does it and not part of the specification. Although not sure....
|
Would it make sense to add a feature to close a connection automatically if you don't get a keep alive after a certain period? |
It could. Would you be willing to take a crack at it and send a PR? |
Idk, I am considering adding a feature where you have a configurable time out in seconds. If there are no chunks to read in the time out period the events() function will return. Do you think I am on the right track? |
Yes |
Ok... I have researched it and decided to try to set a read timeout in urllib3 request. Hopefully it will raise a timeout exception and my code will reset the connection. Will report back if that doesn't work. |
I think I'm having a similar problem with the same API. This is the best debug log i can pull right now as I'm unsure how to check the actual event stream to check it's correct.
The log continues with the normal event stream after this from the stream over the previous 8 hours in the course of 4 seconds. The thing that catches my eye is the time ibetween these events
|
@8633brown If you can reproduce the problem every time it would be great if you could get a tcpdump/pcap capture while this happens. I'm curious if any data is received during those 8 hours or not; if there is data being received, but no event dispatched by the sseclient, then maybe something about the structure of the data stream is confusing the client into thinking that events haven't ended yet. |
Hi All, Im also facing this issue, sseclient stopped receiving the message and had to restart the service to make it work again. Have tried the above pseudocode , but still no luck. Regards, |
try pip install sseclient==0.0.6 |
workaround is posted here #20 |
We are observing that sse client is not receiving any messages from the server. It just hangs unless we restart the client. As soon as the client has been restarted it starts receiving the messages.
The text was updated successfully, but these errors were encountered: