Welcome! Log In Create A New Profile

Advanced

Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

March 28, 2018 03:48PM
Hi,

I have a module that registers a handler to run in
NGX_HTTP_PREACCESS_PHASE. The handler adds headers to
request->headers_in.headers. This works as I would expect most of the
time. But I am seeing cases of some crashes when calling

ngx_list_push(&request->headers_in.headers));

Are there any restrictions where you are not allowed to push to
headers_in.headers like that in the preaccess phase?

This is the line that where the segfault is reported as happening:
https://github.com/opentracing-contrib/nginx-opentracing/blob/master/opentracing/src/inject_span_context.cpp#L23

And the backtrace (taken from
https://github.com/kubernetes/ingress-nginx/issues/2222#issue-306992059):

#0 0x0000561139f929ec in ngx_list_push ()
#1 0x00007f7a1adbb6ab in
ngx_opentracing::inject_span_context(opentracing::v1::Tracer const&,
ngx_http_request_s*, opentracing::v1::SpanContext const&) () from
/etc/nginx/modules/ngx_http_opentracing_module.so
#2 0x00007f7a1adbcf81 in
ngx_opentracing::OpenTracingRequestInstrumentor::OpenTracingRequestInstrumentor(ngx_http_request_s*,
ngx_http_core_loc_conf_s*, ngx_opentracing::opentracing_loc_conf_t*)
() from /etc/nginx/modules/ngx_http_opentracing_module.so
#3 0x00007f7a1adbdce6 in
ngx_opentracing::on_enter_block(ngx_http_request_s*) () from
/etc/nginx/modules/ngx_http_opentracing_module.so
#4 0x000056113a097a33 in ngx_http_core_generic_phase ()
#5 0x000056113a093645 in ngx_http_core_run_phases ()
#6 0x000056113a08f03e in ngx_http_process_request ()
#7 0x000056113a09068c in ngx_http_process_request_line ()
#8 0x000056113a0a6be1 in ngx_epoll_process_events.lto_priv ()
#9 0x000056113a0c45df in ngx_process_events_and_timers ()
#10 0x000056113a0a8405 in ngx_worker_process_cycle ()
#11 0x000056113a0be07f in ngx_spawn_process ()
#12 0x000056113a0a9715 in ngx_master_process_cycle ()
#13 0x0000561139f8a654 in main ()
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 841 March 28, 2018 03:48PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Maxim Dounin 511 March 28, 2018 03:58PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 450 March 28, 2018 04:18PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Maxim Dounin 452 March 29, 2018 09:42AM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 506 March 29, 2018 02:08PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

Robert Paprocki 448 March 29, 2018 02:36PM

Re: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

rnburn 629 March 30, 2018 10:32AM

RE: Restrictions to modifying request->headers_in.headers in NGX_HTTP_PREACCESS_PHASE?

erankor 673 March 31, 2018 10:40AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 185
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready