ERROR:panoramix.decompiler:Problem with name()
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/panoramix/decompiler.py", line 177, in _decompile_with_loader
trace = dec()
File "/opt/homebrew/lib/python3.9/site-packages/timeout_decorator/timeout_decorator.py", line 75, in new_function
old = signal.signal(signal.SIGALRM, handler)
File "/opt/homebrew/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter
This happens because panoramix in one place uses timeout-decorator library.
Precisely here in panoramix/decompiler.py
timeout_decorator project actually describes this problem here:
_Multithreading
By default, timeout-decorator uses signals to limit the execution time of the given function. This appoach does not work if your function is executed not in a main thread (for example if it’s a worker thread of the web application). There is alternative timeout strategy for this case - by using multiprocessing. To use it, just pass usesignals=False to the timeout decorator function:
But just adding use_signals=False would not work as the object is sophisticated enough and can not be pickled which is required by the multiprocessing module
So the full solution to this problem is:
1) pip install wrapt_timeout_decorator
This solves the failure to work not in main thread problem and should also solve not working in Windows problem (although I can not test the second statement)
ERROR:panoramix.decompiler:Problem with name() Traceback (most recent call last): File "/opt/homebrew/lib/python3.9/site-packages/panoramix/decompiler.py", line 177, in _decompile_with_loader trace = dec() File "/opt/homebrew/lib/python3.9/site-packages/timeout_decorator/timeout_decorator.py", line 75, in new_function old = signal.signal(signal.SIGALRM, handler) File "/opt/homebrew/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/signal.py", line 47, in signal handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler)) ValueError: signal only works in main thread of the main interpreter
This happens because panoramix in one place uses
timeout-decorator
library. Precisely here in panoramix/decompiler.pytimeout_decorator project actually describes this problem here:
_Multithreading By default, timeout-decorator uses signals to limit the execution time of the given function. This appoach does not work if your function is executed not in a main thread (for example if it’s a worker thread of the web application). There is alternative timeout strategy for this case - by using multiprocessing. To use it, just pass usesignals=False to the timeout decorator function:
But just adding
use_signals=False
would not work as the object is sophisticated enough and can not be pickled which is required by themultiprocessing
moduleSo the full solution to this problem is: 1) pip install wrapt_timeout_decorator
2) add to panoramix/decompiler.py
3) replace
with
This solves the failure to work not in main thread problem and should also solve not working in Windows problem (although I can not test the second statement)
I can submit a pull request, just let me know