haskell-distributed / distributed-process-client-server

Cloud Haskell - gen_server implementation
http://haskell-distributed.github.io
BSD 3-Clause "New" or "Revised" License
13 stars 11 forks source link

Prioritised process mailbox handling can block indefinitely #12

Closed hyperthunk closed 7 years ago

hyperthunk commented 7 years ago

To simulate this, create a sender that simply goes forever $ cast serverPid () and watch your machine run out of memory (while not much else happens).

Control flow has never been part of Erlang's gen_server API, and neither should it be applicable here. However, we won't have a change to notice that we're overloaded if the server never gets around to responding to any of its inputs, and that's what is happening here.

We enter a loop to drain the mailbox, but do not break out of it. There is a policy item that references this situation, but the pserve implementation ignores it!

Notes: this is only broken for prioritised mailboxes, and will be a fairly simple fix.