Interrupt long running actors #25
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There is currently no mechanism to interrupt actors that have ran for too long. It's easy to do on the JS side, but if the JS calls a function that dips into C that takes a long time, that actor will be tied up. For now, at least get JS checks in; C in the longer run.
There are two ways we can go about doing this:
If a message takes too long to process, if there are other actors waiting, just cancel the message and push it back to the front of the queue, and run it again later. That timer should be like 1/60 of a second.
More complicated but probably better: if an actor takes too long, pause its stack entirely. Each OS thread made w/ pthread with itself have a coroutine it runs its actors in, done with libco or whatever works. If an actor takes too long, inside the JS interrupt, the thread will start a new coroutine and switch to it; once there are no more fast actors looking for work, that same thread will finally switch back to the coroutine which had the slow actor's turn preserved on it.