Skip to content

fix(linux): --reuse-threads thread naming and recycling#748

Open
shekhirin wants to merge 1 commit intomstange:mainfrom
shekhirin:alexey/fix-linux-reuse-threads
Open

fix(linux): --reuse-threads thread naming and recycling#748
shekhirin wants to merge 1 commit intomstange:mainfrom
shekhirin:alexey/fix-linux-reuse-threads

Conversation

@shekhirin
Copy link

Two issues were causing incorrect behavior with --reuse-threads on Linux:

  1. In handle_fork, passing the parent thread's name caused all threads to attempt recycling with the same name at creation time, before they got their actual names via COMM events. Now we pass None - threads get their names and recycle properly when the COMM event arrives.

  2. In rename_non_main_thread, when recycling was enabled but no recycled thread with the target name existed, the rename was silently skipped. Added else branch to fall back to rename_without_recycling.

Before After
image image

Two issues were causing incorrect behavior with --reuse-threads on Linux:

1. In handle_fork, passing the parent thread's name caused all threads to
   attempt recycling with the same name at creation time, before they got
   their actual names via COMM events. Now we pass None - threads get their
   names and recycle properly when the COMM event arrives.

2. In rename_non_main_thread, when recycling was enabled but no recycled
   thread with the target name existed, the rename was silently skipped.
   Added else branch to fall back to rename_without_recycling.
@shekhirin shekhirin closed this Feb 3, 2026
@shekhirin shekhirin reopened this Feb 3, 2026
@shekhirin shekhirin marked this pull request as draft February 3, 2026 16:13
@shekhirin shekhirin marked this pull request as ready for review February 3, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant