Native threads (tpool.execute) not working on child process

Bug #1983949 reported by Gorka Eguileor
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.service
Fix Released
High
Gorka Eguileor

Bug Description

When the parent process used eventlet tpool to run code in native threads then anything the child tries to run in a native thread will hang forever.

The reason for that is that the parent has initialize the pool of threads and use a flag to mark that it has been initialized, and when the child is forked then it will have the flag saying that it has been initialized and expects the threads to be running, but they are not. So there is no thread to pick up the job when a greenlet queues the job, so the greenthread waits forever to get the result of the operation.

After forking the child needs to tell eventlet's tpool that it is not really initialized.

Gorka Eguileor (gorka)
Changed in oslo.service:
assignee: nobody → Gorka Eguileor (gorka)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.service (master)
Changed in oslo.service:
status: New → In Progress
Changed in oslo.service:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.service (master)

Reviewed: https://review.opendev.org/c/openstack/oslo.service/+/852450
Committed: https://opendev.org/openstack/oslo.service/commit/67daa4b3c21b4030a965cc8dd106adafc418b70e
Submitter: "Zuul (22348)"
Branch: master

commit 67daa4b3c21b4030a965cc8dd106adafc418b70e
Author: Gorka Eguileor <email address hidden>
Date: Mon Aug 8 17:50:53 2022 +0200

    Fix native threads on child process

    When the parent process used eventlet tpool to run code in native
    threads then anything the child tries to run in a native thread will
    hang forever.

    The reason for that is that the parent has initialize the pool of
    threads and use a flag to mark that it has been initialized, and when
    the child is forked then it will have the flag saying that it has been
    initialized and expects the threads to be running, but they are not. So
    there is no thread to pick up the job when a greenlet queues the job, so
    the greenthread waits forever to get the result of the operation.

    This patch tells eventlet's tpool to clean things up on the child just
    after forking, that way if the child uses native threads tpool will
    spawn all the threads again.

    Closes-Bug: #1983949
    Change-Id: If2421427c48faa976d6c6ee9bafe4d563288037b

Changed in oslo.service:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.service 3.3.0

This issue was fixed in the openstack/oslo.service 3.3.0 release.

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.