Cancel ongoing ngx_http_request_t

donatasm nginx-forum at nginx.us
Fri May 22 13:34:44 UTC 2015


Ok, so I managed this to work, needed to add ngx_http_send_header and
ngx_http_finalize_request:

static void simple_timeout_handler(ngx_event_t* timeout_event)
{
  ngx_int_t result;
  ngx_http_request_t* request;

  ngx_log_debug0(NGX_LOG_DEBUG_HTTP, timeout_event->log, 0,
    "SIMPLE TIMEOUT TIMER END");

  request = (ngx_http_request_t*)timeout_event->data;

  result = ngx_http_send_header(request);
  ngx_http_finalize_request(request, result);
}

Everything work fine, but during the load test, after some time, a SEGFAULT
occurs:

Thread #1 [nginx] 3352 [core: 7] (Suspended : Signal : SIGSEGV:Segmentation
fault)	
	ngx_destroy_pool() at ngx_palloc.c:51 0x405187	
	ngx_http_free_request() at ngx_http_request.c:3,499 0x42f04b	
	ngx_http_set_keepalive() at ngx_http_request.c:2,901 0x4300d1	
	ngx_http_finalize_connection() at ngx_http_request.c:2,538 0x4300d1	
	ngx_http_finalize_request() at ngx_http_request.c:2,434 0x430e41	
	simple_timeout_handler() at simple_timeout_module.c:135 0x44a8ef	
	ngx_event_expire_timers() at ngx_event_timer.c:94 0x41bf5a	
	ngx_process_events_and_timers() at ngx_event.c:262 0x41bb86	
	ngx_single_process_cycle() at ngx_process_cycle.c:308 0x423c8b	
	main() at nginx.c:416 0x403bc6	

It seems, that pool argument passed to ngx_destroy_pool is not initialized,
any ideas why this could happen?

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,259045,259061#msg-259061



More information about the nginx mailing list