Implementing a non-blocking delay between request and response

Tronman nginx-forum at
Fri Jan 15 21:25:19 MSK 2010

Two problems solved, one more found:


1. I wasn't specifying a wakeupFromSleep->log, so I was seg faulting on the:

    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
                   "event timer add: %d: %M:%M",
                    ngx_event_ident(ev->data), timer, ev->timer.key);

line in ngx_event_add_timer from ngx_event_timer.h

2. I was specifying seconds, not ms. The line should correctly read:

ngx_add_timer(wakeupFromSleep, 30000);


Like before, the connection is closing immediately, even though the event is in fact waking up. The only way I seem to be able to have it not close immediate is to set r->keepalive = 1, which closes when the event times out, but doesn't send my headers. So, like my original question, I still need a way to keep the connection open until the event times out and can send the headers and finalize the response (in 0.7.64, I'm hoping to not have to move to a later version if I can avoid it).


Posted at Nginx Forum:,41283,41743#msg-41743

More information about the nginx mailing list