Skip to content

Comments

threadtree: fix memory leak from thread ident reuse in pools#21

Open
kendriu wants to merge 1 commit intovast-data:vastfrom
kendriu:memory_leak_2
Open

threadtree: fix memory leak from thread ident reuse in pools#21
kendriu wants to merge 1 commit intovast-data:vastfrom
kendriu:memory_leak_2

Conversation

@kendriu
Copy link

@kendriu kendriu commented Feb 20, 2026

the code was adding snapshots to the registry using thread.uuid
as part of the key, then trying to remove them using thread.uuid
again. when threadpoolexecutor reuses thread idents, thread.uuid
can return a different value the second time because it looks up
the uuid based on the thread's ident. this caused the cleanup to
try removing a key that was never added, leaving the old entries
in the registry forever. fix by capturing the uuid once and using
that same value for both adding and removing

the code was adding snapshots to the registry using thread.uuid
as part of the key, then trying to remove them using thread.uuid
again. when threadpoolexecutor reuses thread idents, thread.uuid
can return a different value the second time because it looks up
the uuid based on the thread's ident. this caused the cleanup to
try removing a key that was never added, leaving the old entries
in the registry forever. fix by capturing the uuid once and using
that same value for both adding and removing
@kendriu kendriu changed the title threadtree: fix thread registry key usage to prevent stale references threadtree: fix memory leak from thread ident reuse in pools Feb 20, 2026
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