crash in ngx_add_timer

Dk Jack dnj0496 at
Wed Apr 19 00:12:23 UTC 2017

I am new to NGinx modules and I trying to write an nginx module. I am
having an issue
where my module crashes when adding multiple timers. The first timer adds
However, when I go to add the second timer, it crashes. I've simplified the
code to a very
basic module (which is attached to this email). The backtrace is provided
as well.
Do I need to do some sort of initialization before I add multiple timers.
Any advice/help
is appreciated. Thanks.


Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000000040d68b in ngx_rbtree_insert (tree=0x69dda0
    node=node at entry=0x69db08 <ev2+40>) at src/core/ngx_rbtree.c:44
#2  0x000000000046ceb2 in ngx_event_add_timer (timer=6, ev=0x69dae0 <ev2>)
    at src/event/ngx_event_timer.h:84
#3  ngx_test_init (cf=<optimized out>)
#4  0x0000000000424e83 in ngx_http_block (cf=0x7fffffffe0a0, cmd=<optimized
    conf=<optimized out>) at src/http/ngx_http.c:315
#5  0x000000000041446b in ngx_conf_handler (last=1, cf=0x7fffffffe0a0)
    at src/core/ngx_conf_file.c:427
#6  ngx_conf_parse (cf=cf at entry=0x7fffffffe0a0, filename=filename at entry
    at src/core/ngx_conf_file.c:283
#7  0x0000000000411e1a in ngx_init_cycle (old_cycle=old_cycle at entry
    at src/core/ngx_cycle.c:268
#8  0x0000000000404208 in main (argc=<optimized out>, argv=<optimized out>)
at src/core/nginx.c:268
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-test-module.c
Type: text/x-csrc
Size: 3687 bytes
Desc: not available
URL: <>

More information about the nginx-devel mailing list