Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix leaking timeout #1

wants to merge 7 commits into


None yet
2 participants

jlouis commented Nov 20, 2010

Hi Ulf,

I have two branches that might be of interest to you: jlouis:fix-leaking-timeout and jlouis:fix-leaking-timeout-2. It is two alternative ways to fix the same problem, namely that await/2 will leak timeouts.

Personally, I prefer the -2 variant. Also note that I based this on the esl/gproc branch, hence it asks to pull 7 commits rather than one.

Ulf Wiger and others added some commits Oct 22, 2010

Limit the leakiness of a timeout in gproc:await/2.
If we get a value before timeout happens, the timer is still there and
will fire at a later time. This means that the timeout will leak from
gproc into the process which called await/2 and that process might not
be ready to handle the problem.

This fix cancels the timer if the normal message is received. It does
not eliminate the leak though, since the timer might have fired just
before we get to receive the message and thus be in the msg queue of
the process. The cancel will then fail and the timeout will have
leaked. To give a receiver a hint, we have opted to make timeout into
gproc_timeout as an atom() in the hope this will suggest where to

uwiger commented Nov 21, 2010

Thanks. I merged the first version. The main reason for using a timer was that the function performs a synchronous call first in order to get the reference from the server. This call could, albeit rarely, introcude a significant delay, which would then add to the specified time limit.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment