libev application stops responding and consumes 100% cpu

Kirill Timofeev kvt at hulu.com
Tue Apr 8 09:40:41 CEST 2014


Hi Marc,

yes, I was using this url as starting point: 
http://codefundas.blogspot.com/2010/09/create-tcp-echo-server-using-libev.html

Could you please point me to code example or documentation regarding 
current best practice for keeping event loop running forever?

here is excerpt from my code:

     ev_periodic_init (&ds_health_check_timer_watcher, 
ds_health_check_timer_cb, ds_health_check_timer_at, 
global.downstream_health_check_interval, 0);
     ev_periodic_start (loop, &ds_health_check_timer_watcher);
     ev_periodic_init (&ds_flush_timer_watcher, ds_flush_timer_cb, 
ds_flush_timer_at, global.downstream_flush_interval, 0);
     ev_periodic_start (loop, &ds_flush_timer_watcher);

     while (1) {
         ev_loop(loop, 0);
     }

those timers are never removed from event loop. 100% cpu load and frozen 
program show, that while loop was running empty event loop. Is it 
expected, that watchers would be dropped from event loop? Would it be 
good idea to move timer initialization/start calls in the while loop as 
well?

Thanks,
Kirill.

On 04/07/2014 10:40 PM, Marc Lehmann wrote:
> On Mon, Apr 07, 2014 at 06:40:03PM -0700, Kirill Timofeev <kvt at hulu.com> wrote:
>> I'm not calling ev_run directly in my code, but let me check latest
> the backtrace shows it is being called from main. maybe you are using the
> libev3 compatibility mode: in libev3, ev_run was called ev_loop.
>




More information about the libev mailing list