Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Unhandled exception when shutting down database process #862

@gsalgado

Description

@gsalgado

What is wrong?

Occasionally get an unhandled exception when I Ctrl+C trinity on the terminal:

^C    INFO  06-04 14:58:59        main  Keyboard Interrupt: Stopping                                                                                                            
    INFO  06-04 14:58:59         ipc  Sent SIGINT to process 27652, waiting 5 seconds for it to terminate                                                                       
Process ForkProcess-1:                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                              
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap                                                                                                 
    self.run()                                                                                                                                                                  
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run                                                                                                         
    self._target(*self._args, **self._kwargs)                                                                                                                                   
  File "/home/salgado/src/py-evm/trinity/utils/profiling.py", line 27, in inner                                                                                                 
    return fn(*args, **kwargs)                                                                                                                                                  
  File "/home/salgado/src/py-evm/trinity/utils/logging.py", line 115, in inner
    return fn(*args, **inner_kwargs)
  File "/home/salgado/src/py-evm/trinity/main.py", line 195, in run_database_process
    serve_chaindb(chain_config, base_db)
  File "/home/salgado/src/py-evm/trinity/chains/__init__.py", line 187, in serve_chaindb
    server.serve_forever()  # type: ignore
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 167, in serve_forever
    sys.exit(0)
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 261, in _bootstrap
    util._exit_function()
  File "/usr/lib/python3.6/multiprocessing/util.py", line 322, in _exit_function
    _run_finalizers()
  File "/usr/lib/python3.6/multiprocessing/util.py", line 262, in _run_finalizers
    finalizer()
  File "/usr/lib/python3.6/multiprocessing/util.py", line 186, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/multiprocessing/queues.py", line 191, in _finalize_join
    thread.join()
  File "/usr/lib/python3.6/threading.py", line 1056, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

Again, it looks like the kind of thing that would be caused by the multiprocessing module:

If the SIGINT signal generated by Ctrl-C arrives while the main thread is blocked by a call to BoundedSemaphore.acquire(),
Lock.acquire(), RLock.acquire(), Semaphore.acquire(), Condition.acquire() or Condition.wait() then the call will be immediately
interrupted and KeyboardInterrupt will be raised.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions