SCALE-MS / scale-ms

SCALE-MS design and development
GNU Lesser General Public License v2.1
4 stars 4 forks source link

Clean up threaded RP interaction #334

Open eirrgang opened 1 year ago

eirrgang commented 1 year ago

In several cases, we avoid blocking the asyncio event loop by wrapping rp calls in ThreadPoolExecutor threads. However, even if the wrapping asyncio Tasks time out, a running Thread cannot generally be cancelled. If the rp call blocks forever, the thread pool could fill up.

We need to make sure that all wrapped rp calls have some sort of guarantee of completion, or we need to appropriately treat timeouts of thread futures as potentially critical internal disruptions of the program state.

In some cases, we can look for alternative coding constructs that allow for periodic polling or for an Exception to be injected that would interrupt the Thread.

Near-term steps in addressing this issue include enumerating the non-trivial occurrences of potentially-hanging wrapped blocking calls.