pnpnpn / timeout-decorator

Timeout decorator for Python
MIT License
628 stars 94 forks source link

ValueError: signal only works in main thread of the main interpreter #75

Open vadimszzz opened 2 years ago

vadimszzz commented 2 years ago
Traceback (most recent call last):
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 83, in on_output
    _pipe(stdout, stderr)(fd, data)
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 43, in pipe
    _output(data)
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 122, in exit_handler
    if not frida_utils.process_is_running(frida_device, pid) and str(stderr[:-1]).isdigit():
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/utils.py", line 76, in wrapper
    return func(*args, **kwargs)
  File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/timeout_decorator/timeout_decorator.py", line 75, in new_function
    old = signal.signal(signal.SIGALRM, handler)
  File "/Users/x/.pyenv/versions/3.9.0/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
Traceback (most recent call last):
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 83, in on_output
    _pipe(stdout, stderr)(fd, data)
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 43, in pipe
    _output(data)
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/shell.py", line 122, in exit_handler
    if not frida_utils.process_is_running(frida_device, pid) and str(stderr[:-1]).isdigit():
  File "/Users/x/Downloads/Projects/ios-apps-research-2022/exynex/utils.py", line 76, in wrapper
    return func(*args, **kwargs)
  File "/Users/x/.pyenv/versions/3.9.0/lib/python3.9/site-packages/timeout_decorator/timeout_decorator.py", line 75, in new_function
    old = signal.signal(signal.SIGALRM, handler)
  File "/Users/x/.pyenv/versions/3.9.0/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
chucklesoclock commented 2 years ago

https://github.com/pnpnpn/timeout-decorator#multithreading