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

Alessandro Sivieri alessandro.sivieri@REDACTED
Sat Jun 13 10:54:26 CEST 2015


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?
Suggestions?

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>},
                       {name,timer_server},
                       {mfargs,{timer,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,1000},
                       {child_type,worker}]

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
alessandro.sivieri@REDACTED
http://sivieri.me/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150613/ac8f220c/attachment.htm>


More information about the erlang-questions mailing list