angr/claripy

`pytest -n` fails because of `signal` occasionally

Closed this issue · 0 comments

Description

Something to note, I’ve been getting pytest failures recently when doing things like pytest -n47. Example output is attached.

We do indeed use os.signal in the backend_z3.py file here:

signal.signal(signal.SIGINT, handle_sigint)

Most invocations of pytest do not lead to this, but sometimes they will.

Steps to reproduce the bug

In a fresh clone of angr-dev:
cd angr && pytest -n47

Environment

Fresh clone of master

Additional context

Example output:

======================================= ERRORS ========================================
_________________________ ERROR collecting tests/test_0div.py _________________________
tests/test_0div.py:4: in <module>
    import angr
angr/__init__.py:40: in <module>
    from .sim_procedure import SimProcedure
angr/sim_procedure.py:549: in <module>
    from angr.state_plugins.sim_action import SimActionExit
angr/state_plugins/__init__.py:3: in <module>
    from .libc import *
angr/state_plugins/libc.py:268: in <module>
    from angr.sim_state import SimState
angr/sim_state.py:15: in <module>
    import claripy
../claripy/claripy/__init__.py:21: in <module>
    from . import backends as _backends_module
../claripy/claripy/backends/__init__.py:771: in <module>
    from .backend_z3 import BackendZ3
../claripy/claripy/backends/backend_z3.py:43: in <module>
    signal.signal(signal.SIGINT, handle_sigint)
/usr/lib64/python3.10/signal.py:56: in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
E   ValueError: signal only works in main thread of the main interpreter
ERROR tests/analyses/cfg_slice_to_sink/test_cfg_slice_to_sink.py - ValueError: signal only works in main thread of the main interpreter