Several door servers don't properly handle exiting threads
In investigating #11039, it was discovered that some door servers fail to cause thread counts to decrement on thread exit.
Door servers can register their own thread-creation functions. These functions can maintain whatever size thread pool they want, and can block requests if too many threads are active. However, they must ensure that at least one thread is available to server requests.
Many of these 'limiting' door servers use thread-specific data to decrement the number of active threads in the case that a thread exists. However, nearly all of them set the TSD value to NULL, which means the destructor never gets called, and so the thread count is never decremented. This could lead to a complete depletion of the thread pool, and so no new door requests can be served.
Note that, under normal circumstances, door server threads never exit - they're supposed to use 'door_return' instead of allowing an exit - and so this should only happen due to programming errors. Thread exit should still be handled appropriately, particularly in the presence of library code.
idmapd, nscd, and ldapcachemgr all use TSDs to handle this, but set 'value' to NULL. nfs-mountd also uses TSD destructors to handle thread counts, but selectively sets 'value' to 1 for reasons that aren't clear, and as such isn't included in this bug.
Found by code inspection; There is no known method to test this, and it's unclear if any threads actually exit.
Updated by Electric Monk over 1 year ago
- Status changed from In Progress to Closed
- % Done changed from 0 to 100
commit fea136a04b3f86ab3ec31e4c157379030fee9ade Author: Matt Barden <email@example.com> Date: 2019-06-06T15:13:38.000Z 11004 Several door servers don't properly handle exiting threads 11198 Allow adjustment of max_threads for idmapd Reviewed by: Gordon Ross <firstname.lastname@example.org> Reviewed by: Evan Layton <email@example.com> Approved by: Garrett D'Amore <firstname.lastname@example.org>