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
fix for stack growth on reconnect #854
Conversation
…d except TimeoutError - raise WebSocketTimeoutException
…ent compatibility): WrappedDispatcher (for use with generic event dispatchers such as pyevent and rel); create_dispatcher() accepts dispatcher kwarg (default None), and if it is specified, returns a WrappedDispatcher; use create_dispatcher() (passing specified dispatcher if any) every time (regardless of dispatcher specification)
…fault False] is True) to setSock() (prevents those lines from running on ConnectionRefusedError)
… mode); added stack frame count to disconnect (warning) log; grossly oversimplified ;)
…edDispatcher.timeout()
… to SSLDispatcher)
…er (uses timeout()); setSock() reconnecting (default False) kwarg - if reconnecting, skip handleDisconnect(); handleDisconnect() calls dispatcher.reconnect()
Does the stack grow in version 1.3.3 as well or only 1.4.0? |
Hi, I don't know about stack grow, but for sure 1.4.0 is introducing a bug when used with SSLDispatcher that is causing error |
We've rolled back to version 1.3.3 - the upgrade to version 1.4.0 broke something for us. Our server might be responsible too, but the client behaviour in 1.3.3 didn't cause any trouble. |
…tered with setReconnect()) to preserve old (non-reconnecting) default behavior for existing integrations
websocket/tests/test_app.py
Outdated
@@ -6,6 +6,7 @@ | |||
import websocket as ws | |||
import ssl | |||
import unittest | |||
import rel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to fix the testRunForeverDispatcher() test -- the 'dispatcher="Dispatcher"' previously on line 101 isn't correct.
I'm not sure if lines 102-103 will actually make the test work, I don't know how to add rel to the test dependencies.
Do these tests work in the master branch? As far as I can tell, testRunForeverDispatcher() at least doesn't seem like it could have.
…and testRunForeverDispatcher() (also not working previously afaik)
…to True before calling on_error callback)
Codecov Report
@@ Coverage Diff @@
## master #854 +/- ##
==========================================
- Coverage 84.53% 82.87% -1.67%
==========================================
Files 13 13
Lines 1293 1331 +38
Branches 274 278 +4
==========================================
+ Hits 1093 1103 +10
- Misses 128 153 +25
- Partials 72 75 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hello all. @engn33r, all the tests are passing now, with the exception of the Codecov tests (which indicate decreased coverage), which makes sense, because there aren't tests yet for the new code. I disabled the testRunForeverDispatcher() test because it can only work with rel, but I don't know how to add rel to the test dependencies. Also, I don't think this test is working in master. I propose we merge this in and call it 1.4.1 for @aantn and @ollo69 and the other ha-samsungtv-smart people. |
Nice work @bubbleboy14! I will merge and create a new release. With all the effort you've put in lately, send me an email at websocket.client.email [at] gmail.com if you're interested in joining as a co-maintainer. |
after upgrading to 1.4.1 i'm getting following error:
Things work as expected with version 1.3.3 wondering from where this error is coming from? |
Actually found that the error is coming from THIS line |
Funny thread about sock.pending(): https://bugs.python.org/issue21430 These people in 2014 were saying "this function should not be used" - maybe it got removed in a recent version of Python. Feel up to patching this @maksimu? |
Funny indeed, and puzzling at the same time.
I doubt, I'm on Python 3.10 and it works fine with websocket-client version 1.3.3 but when I upgrade it to 1.4.0+ I'm getting this error.
Python is not my strongest language, just maintaining things here and there, so I would be better if someone more knowledgeable could look at what's going on and patch it up. |
@maksimu do you have a concise test case for this? My wss tests aren't failing. |
previously, using the default (synchronous) dispatcher, reconnecting would cause the stack to grow.
here's the fix.