EventSource
EventSource copied to clipboard
Possible connection leak? A new SSE connection is opened on every onerror status=undefined
Hi @Yaffle need your help in figuring this out. I see a pattern where a new connection is opened on every onerror
and the status for the on error is status=undefined
. The client does not get any data through SSE connection and after few seconds onerror
with status=undefined
is invoked again and a new connection is made to the backend.
All these connections kept open till the browser/session is closed and all the connections are closed together.
Could you please help in figuring this out and understand why this is happening and help in fixing it?
@akaskj , how to reproduce? In which web browser can this be reproduced?
@akaskj , how to reproduce? In which web browser can this be reproduced?
@Yaffle Unable to reproduce it locally, this is happening in client systems in production. I am trying to put in more logging when an error
event is fired and trying to narrow down on a particular scenario.
Had anyone else complained about this? or come across this issue before?
@akaskj does it happen for all clients? are you using HTTPS ? How should the polyfill behave in case it cannot receive data?
Sorry, missed your reply. It happens only with a subset of clients. Yes we are using HTTPS. The problem is data is sent from the server but polyfill is reporting as it never received the data and triggers onerror and opens new SSE connection.
I am also getting this problem and only in production. It's weird, we have a DEV/QA/Prod environment and it's only happening in Prod. They are all configured the same.
We get a 'onerror' message with (no communication in 45 seconds) every 45 seconds.
Will look into it more, but I'm not sure why our keepalives aren't helping.
Edit: Every browser
@henry-chris , could you try a new version? I have added some details to this error message.
@Yaffle I can, thanks. Sadly, my error was due to a bug in our production deployment where my keep-alives weren't getting through in specific instances. Fixing those has alleviated the triggering of this error message in most cases.
I will try it and cause the error a few times and report back.
same problem.
i print readyState
is 0 and error
is undefined in ErrorEvent
.
@Veitor , unfortunately, I have no ideas how to fix it, please use other libraries which switch to non-SSE transports
@Yaffle Sorry it's taken me a bit. I see an error message explaining the issue and a call stack. Seems good to me.
Since you say 'Reconnecting' I'm guessing I don't need to re-open the connection manually (which I'm currently doing).
We send a keep-alive every 25 seconds...so I'll have to look into why that isn't being found by the polyfilll as I can confirm it's sent. That seems to be an entirely separate issue from this, though.