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>
This commit is contained in:
Bart Wensley 2020-05-27 13:50:03 -05:00
parent 615340ce62
commit fca019fbe9
2 changed files with 5 additions and 2 deletions

View File

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

View File

@ -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()