[erlang-questions] The timer server: bug or feature?

Scott Lystig Fritchie fritchie@REDACTED
Wed Apr 15 23:09:09 CEST 2009


Hi, all.  I've got an app that uses the timer module liberally,
specifically timer:send_interval/2.  I also have some regression tests
that starts hundreds of gen_server and gen_fsm processes that use
timer:send_interval/2 (usually with a period of 1 second) and are
stopped a few seconds later ...  both nicely shutdown and
not-very-nicely stopped by exit(Pid, kill).

After the regression tests finish and all test processes are dead, I
find that the timer_server process is consuming about 45% of one of my
CPU cores.  The undocumented timer:get_status/1 function says:

    (foo_dev@REDACTED)6> application:stop(foo).
    ok
    (foo_dev@REDACTED)7> timer:get_status().
    {{timer_tab,1096},{timer_interval_tab,184}}

(This is Erlang/OTP R12B-5, on a Linux platform, if that matters.)

So it seems like there are hundreds of items that are orphaned in the
timer server's private state.  Is this a bug or feature?  The OTP docs
say that the caller of send_interval/2 will be link()'ed, which I assume
means that cleanup should be automatic....

-Scott



More information about the erlang-questions mailing list