-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
BinanceWebSocketApiManager._create_stream_thread() stream_id=7bb5ef452f01-7200-c1f7-310c-f7e4ee8e - RuntimeError error: 11
- error_msg: cannot schedule new futures after interpreter shutdown
#299
Comments
Thank you! We need log files and a script to reproduce the error... |
Thanks Oliver, this time I did not manage to produce a log file. But once I encounter it again will send the log file here. Thanks again. |
@oliver-zehentleitner I am getting same error. Is there anyway how it can be handled with exceptions?
Ill try to log it and post what i get out |
Hello! Affected lines of code: Script to replicate (Thanks to nhmartens): I know and understand this issue, but when we get in touch with it the first time (#131) it happened also in other code parts which was very easy to reproduce within seconds and i did not want to "over fix it" with code parts that may be not necessary to solve it. I thought its possible that since we fixed it in #131 i could also avoid it here in this code block. To implement a CLEAN solution i would need one log file in INFO or even DEBUG logging mode... to see what exactly is happening inside ubwa before the exception occurs. If you gives give me such a log file, i will start updating it on 2.1.2023 and prepare a fixed release. |
This is the log file of my replication run, I hope this helps. |
@oliver-zehentleitner is there any update on this? Is the log file I provided what you were looking for or do you need anything else? |
I will pick this up at next, but i get to tired for this now :/ |
Up plz |
Does anyone have any suggestions for a temporary fix for this until it gets resolved? |
i should be able to find the time today or tomorrow. i will get back to you with the update. |
Thank you! Your work is very much appreciated 😎 |
tomorrow, sorry, was too busy today :/ |
This error message occurs when a shutdown process has been initiated by the Python interpreter. This means that the interpreter is about to exit, and thus cannot accept any new tasks. This happens when I can't replicate the problem so far. I don't know if it's possible to start new threads again after this error, doesn't sound like it actually. Basically, I also find that when the shutdown process is initiated, the code does exactly what it is supposed to. it shuts down UBWA cleanly and exits.
So the problem must/should be solved in the program logic. Does this code work for you and avoid the error?
|
I don't think this solution will 100% work. To reproduce the error, I raised the As a result, the problem was reproduced, but I did not manage to fix it correctly. In the end, I just removed from this block self.manager.stream_is_crashing(self.stream_id, error_msg)
self.manager.set_restart_request(self.stream_id)
sys.exit(1) and added And in the callback where I process the message I do this (I just restart the process) if 'need_restart_process' in data:
os.execl('/usr/local/bin/python', 'python', *sys.argv) # nosec B606:start_process_with_no_shell This is very crutch, but I did not find another solution. |
error: 11
- error_msg: cannot schedule new futures after interpreter shutdown - Please create an issue: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/chooseerror: 11
- error_msg: cannot schedule new futures after interpreter shutdown
Actually a simple
at the end of your script (before it finishs) should fix this issue... have you ever tryed? |
Ok. I will try it. |
Not works |
I also tried this, and it did not solve the issue for me. |
The script mentioned here replicates the error for me. However, it usually takes between two and four days until the issue occurs and the script exits. |
You don't have to wait a few days. You can reproduce the bug by throwing an |
I used it and shorted it, then i added a possible fix - this is the result: #299 (comment) Please can you test it? |
Please test #299 (comment) with the latest and unmodified lib version. In your simulation of the bug, can you set this to And tell me what then happens? |
It seems updating to version 1.42.0 and setting |
Is it worth waiting for a fix inside the library? |
We easily could add a flag to bypass "self.manager.socket_is_ready[self.stream_id] = True". So a fix would be pretty easy. But adding this has also a downside, becouse now you have an unlimited blocking create_stream() function isnt it? And i really beflief its fixed on the wrong end.... i bet that now also a code structure similar to #299 (comment) fixes the problem. |
No, I didn't even use |
Maybe add it to |
Ok, but the framework I provided in #299 (comment) is maybe the smarter way than hacking the lib 😄 |
Agreed, but the |
I also prefer:
|
I leave this for now as it is and wait for more feedback of the community... |
any news, did my suggestion solve your issues? |
Yes, for more than a week about 10 stages have been working continuously. |
Cool. Then i will close this. Reopen if needed. Thanks! |
Version of this library.
Latest
Solution to Issue cannot be found in the documentation or other Issues and also occurs in the latest version of this library.
Hardware?
Local server/workstation
Operating System?
Windows
Python version?
Python3.9
Installed packages
No response
Logging output
No response
Processing method?
stream_buffer
Used endpoint?
binance.com
Issue
BinanceWebSocketApiManager.stream_is_crashing(7bb5ef452f01-7200-c1f7-310c-f7e4ee8e)
BinanceWebSocketApiManager._create_stream_thread() stream_id=7bb5ef452f01-7200-c1f7-310c-f7e4ee8e - RuntimeError
error: 11
- error_msg: cannot schedule new futures after interpreter shutdown - Please create an issue: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api/issues/new/chooseThe text was updated successfully, but these errors were encountered: