[erlang-questions] timer, bug !?

Dmitry Kolesnikov dmkolesnikov@REDACTED
Sun Aug 5 06:33:35 CEST 2012


Hello,

I am getting a wired eunit test failure. I am sorry,  the code is complicated and it cannot be share here. In nutshell, I do have a gen_server that uses timer:send_after(...) to send timeout message to itself, often it uses timeout equals to 0. If some other message arrives before timeout, then timer is cancelled by timer:cancel(...)

Sometimes, with probability 1/5 - 1/6 timeout message is duplicated, see log below. However, if I switch to erlang:send_after and erlang:cancel_timer the issue disappears. Doe anyone seen a similar effect? Why timer duplicates message?


07:21:51.683 [error] make timer: <0.183.0> T=0
07:21:51.684 [error] timeout <0.183.0> 
...
07:21:51.693 [error] make timer: <0.183.0> T=0
...
07:21:51.695 [error] cancel timer: <0.183.0> 
07:21:51.696 [error] make timer: <0.183.0> T = 0
07:21:51.696 [error] timeout <0.183.0>
07:21:51.697 [error] make timer: <0.183.0> T = 0
07:21:51.698 [error] cancel timer: <0.183.0> 
07:21:51.699 [error] make timer: <0.183.0> T = 0
07:21:51.699 [error] timeout <0.183.0> 
07:21:51.700 [error] make timer: <0.183.0> T = 0
07:21:51.701 [error] timeout <0.183.0> 
07:21:51.701 [error] timeout <0.183.0>

Best Regards, Dmitry


More information about the erlang-questions mailing list