-
Notifications
You must be signed in to change notification settings - Fork 302
ThreadPoolExecutor resource leak on exception #221
Copy link
Copy link
Open
Description
File: concordia/agents/entity_agent.py — Lines 267–269
Severity: Medium-High
Description:
A ThreadPoolExecutor is created without using Python's context manager (with statement). If self._parallel_call_() on line 268 raises an exception, executor.shutdown() on line 269 will never execute, leaving threads running in the background. Over time (especially in long-running simulations), this leaks system resources and can lead to thread starvation.
Current code:
executor = futures.ThreadPoolExecutor()
contexts = self._parallel_call_('pre_act', action_spec, executor=executor)
executor.shutdown(wait=True) # skipped if line above throwsSuggested fix: Use the context manager pattern: with futures.ThreadPoolExecutor() as executor:.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels