process did not exit when calling sys.exit with privsep

Bug #1942754 reported by Sean Pang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.privsep
New
Undecided
Unassigned

Bug Description

In our product, we found when calling sys.exit using a new thread under privsep, the process did not exit and hang there forever, thus the process became a zombie process.

Monitor did not find the process is dead and not trying to restart it.

node_agent_pri = priv_context_factory(priv_ctx_name='node_agent_pri', pyfile='main')

def priv_context_factory(lock_name=None, priv_ctx_name=None, pyfile=None):
    _errors = []
    if priv_ctx_name is None:
        _errors.append('priv_ctx_name')
    if pyfile is None:
        _errors.append('pyfile')
    if _errors:
        exception_msg = 'Missing arguments: %s' % ', '.join(_errors)
        raise Exception(exception_msg)
    priv_context.init(root_helper=PRIVSEP_ROOT_HELPER)
    return PrivContextPlus(pyfile, lock_name=lock_name,
                           pypath=__name__ + '.' + priv_ctx_name,
                           capabilities=PRIVSEP_CAPS)

in main.py

@privilege.node_agent_pri.entrypoint
def main():
    some_logic() <------- call threading.Thread to generate a new thread A here.

A.start():
    when something wrong:
       sys.exit(1) <--------- here it will not exit and hang for ever.

There is not error logs or exception tracestack when this issue happens

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.