[erlang-questions] Different behavior of the timer starting from command line or Erlang shell

Bengt Kleberg bengt.kleberg@REDACTED
Sat Jun 13 20:47:08 CEST 2015


According to the manual page for the timer module, apply-interval/4 is linked to a process
When that process dies the timer dies
Kill your shell and both will behave the same


Sent from my iPhone

On 13 Jun 2015, at 10:54, Alessandro Sivieri <alessandro.sivieri@REDACTED<mailto:alessandro.sivieri@REDACTED>> wrote:

Hi all,

I know this is probabily a silly question, but I really cannot understand the cause of following behavior: I have a small application* that communicates (through a TCP connection) with a data logger, and downloads data samples once per minute. To do that, the main function of the application invokes the function that performs the TCP call and gets the samples, and then it invokes timer:apply_interval with the same function as parameter (and, of course, 60 seconds).

Now, if I open the Erlang shell and invoke the main function, everything goes smooth; if I start the application from the command line (-s main_module main_function), then the first sample is correctly downloaded, but no other sample is collected.

After many different tries and experiments, I still have no clue why... I mean, the main function is the same! Why two different behaviors?

I have also tried starting with boot_sasl, to get some logs, and after the first sample is collected, the log reports

=PROGRESS REPORT==== 13-Jun-2015::10:49:43 ===
          supervisor: {local,kernel_safe_sup}
             started: [{pid,<0.53.0>},

so I guess the timer server is correctly started... but my function is never invoked.

* by "application" I don't mean an OTP application, I mean just three Erlang modules.

Sivieri Alessandro
erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150613/6a5884e3/attachment.htm>

More information about the erlang-questions mailing list