On Friday, November 25, 2016 at 4:12:54 PM UTC+8, Gaurav Halwasia wrote:
>
> I have a scenario where i have a libuv event loop and at some point of 
> time in my application (C application), i start the timer
>
>    uv_timer_init(&link->loop, timer);
>    uv_timer_start(timer, modbus_ctl_periodic_monitor, 0, 1000);
>
> But i see that there are times when this timer goes off periodically 
> correctly from the beginning and repeats thereafter. But i see that some 
> times, it takes few seconds (20 to 40 seconds in my case) for the timer to 
> get fired first time and then it repeats correctly thereafter. 
>
> I am not able to understand/debug why this initial delay is there 
> (sometimes)
>
> During the time when this initial delay is there i see that uv_run is 
> stuck as can be seen below.
> #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
> #1  0x000000000041a78a in uv.epoll_wait ()
> #2  0x0000000000418ddc in uv.io_poll ()
> #3  0x0000000000410030 in uv_run ()
> #4  0x00007ffff70b6802 in dslink_handshake_handle_ws () from 
> /home/ghalwasi/work/iox-services/c-mlib/deps/libs/libsdk_dslink_c.so
> #5  0x00007ffff70b25db in dslink_init () from 
> /home/ghalwasi/work/iox-services/c-mlib/deps/libs/libsdk_dslink_c.so
>
>
> When starts working, i see that uv_run has called uv_run_timers. 
> (gdb) bt
> #0  0x00007ffff6ba3c53 in select () at 
> ../sysdeps/unix/syscall-template.S:81
> #1  0x00007ffff6e7daf5 in _connect (sockfd=29, 
> addr=addr@entry=0x7ffff3754bd0, addrlen=addrlen@entry=16, 
> ro_tv=ro_tv@entry=0x7fffdc0079e0) at modbus-tcp.c:284
> #2  0x00007ffff6e7dbcc in _modbus_tcp_connect (ctx=0x7fffdc0079d0) at 
> modbus-tcp.c:344
> #3  0x000000000040ca63 in mb_master_connect (mb_ctl=0x7fffc800d190) at 
> modbus_master.c:67
> #4  0x000000000040b868 in modbus_read_snapshot (mb_ctl=0x7fffc800d190) at 
> modbus_ctrl.c:523
> #5  0x000000000040bac4 in modbus_ctl_periodic_monitor 
> (timer=0x7fffc8010690) at modbus_ctrl.c:569
> #6  0x00000000004170ae in uv.run_timers ()
> #7  0x000000000040ff9a in uv_run ()
> #8  0x00007ffff70b6802 in dslink_handshake_handle_ws () from 
> /home/ghalwasi/work/iox-services/c-mlib/deps/libs/libsdk_dslink_c.so
>
>  
> Can someone shed more light on this and help me resolve this issue.. 
>

Did you do some slow work in the uv thread ? does function 
`modbus_ctl_periodic_monitor` execute for a long time ?

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to libuv+unsubscr...@googlegroups.com.
To post to this group, send email to libuv@googlegroups.com.
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to