Allow VIM to shutdown when all FDs are used

When the VIM attempts to shut down because it runs out of FDs,
the shutdown code attempts to create a file, before it activates
a SIGALRM timer that triggers fail safe shutdown. When all FDs
have been consumed, the shutdown code hangs while creating the
file and never shuts down.

This is fixed by changing the shutdown code to first start the
failsafe SIGALRM timer. That way the process is guaranteed to
be terminated even if it hangs while attempting to create the
file.

Change-Id: I7184fe1333d2641227c193f7c8e2e7b1bebcfed8
Partial-Bug: 1862049
Signed-off-by: Bart Wensley <barton.wensley@windriver.com>
changes/02/731302/1
Bart Wensley 3 years ago
parent 615340ce62
commit fca019fbe9
  1. 2
      nfv/centos/build_srpm.data
  2. 5
      nfv/nfv-vim/nfv_vim/vim.py

@ -1 +1 @@
TIS_PATCH_VER=78
TIS_PATCH_VER=79

@ -217,9 +217,12 @@ def process_main():
sys.exit(200)
finally:
open(PROCESS_NOT_RUNNING_FILE, 'w').close()
# Allow up to 10 seconds for the process to shut down. If the
# process_finalize hangs, we will do a hard exit.
signal.signal(signal.SIGALRM, _force_exit)
signal.alarm(10)
# Touching this file after the SIGALRM timer is started. This is to
# ensure that in cases where we are terminating due to FD exhaustion
# we still shut down even if the open hangs.
open(PROCESS_NOT_RUNNING_FILE, 'w').close()
process_finalize()

Loading…
Cancel
Save