apache / trafficserver

Apache Traffic Server™ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.82k stars 804 forks source link

SEGV on HttpTransact::is_stale_cache_response_returnable #9310

Open masaori335 opened 1 year ago

masaori335 commented 1 year ago

This crash happens intermittently, so this doesn't block the 9.2.0 release, IMO.

[ 00 ] libpthread-2.17.so  __libc_waitpid                                                            
[ 01 ] traffic_server      crash_logger_invoke                                                       ( Crash.cc:168 )
[ 02 ] libpthread-2.17.so                                                                            
[ 03 ] traffic_server      HttpTransact::is_stale_cache_response_returnable(HttpTransact::State*)    ( HttpTransact.cc )
[ 04 ] traffic_server      HttpTransact::OSDNSLookup(HttpTransact::State*)                           ( HttpTransact.cc:1951 )
[ 05 ] traffic_server      HttpSM::call_transact_and_set_next_state(void (*)(HttpTransact::State*))  ( HttpSM.cc )
[ 06 ] traffic_server      HttpSM::state_hostdb_lookup(int, void*)                                   ( HttpSM.cc )
[ 07 ] traffic_server      HttpSM::main_handler(int, void*)                                          ( HttpSM.cc )
[ 08 ] traffic_server      handleEvent                                                               ( eventsystem/I_Continuation.h:227 )
[ 09 ] traffic_server      HostDBContinuation::dnsPendingEvent(int, Event*)                          ( HostDB.cc:1070 )
[ 10 ] traffic_server      handleEvent                                                               ( I_Continuation.h:227 )
[ 11 ] traffic_server      EThread::process_event(Event*, int)                                       ( UnixEThread.cc:153 )
[ 12 ] traffic_server      EThread::execute_regular()                                                ( UnixEThread.cc:262 )
[ 13 ] traffic_server      EThread::execute()                                                        ( UnixEThread.cc:353 )
[ 14 ] traffic_server      spawn_thread_internal                                                     ( Thread.cc:79 )
[ 15 ] libpthread-2.17.so  start_thread                                                              

Frame 3 reports that the SEGV happens on this line, but it's a bit odd. https://github.com/apache/trafficserver/blob/c26d71cc35acff7ad8a9a98de45433305be9318c/proxy/http/HttpTransact.cc#L6034

(gdb) frame 3
#3  0x0000560855ec770f in HttpTransact::is_stale_cache_response_returnable(HttpTransact::State*) (s=0x7f898856f8a0) at HttpTransact.cc:6034
6034      if (!s->cache_info.directives.does_client_permit_lookup) {
(gdb) p s
$1 = (struct State *) 0x7f898856f8a0
(gdb) p *s
$2 = <incomplete type>
(gdb) p s->cache_info
There is no member named cache_info.

On frame 4, s->cache_info.directives.does_client_permit_lookup is accessible and it's true

(gdb) frame 4
#4  0x0000560855ec50cc in HttpTransact::OSDNSLookup(HttpTransact::State*) (s=0x7f898856f8a0) at HttpTransact.cc:1951
1951          if (is_cache_hit(s->cache_lookup_result) && is_stale_cache_response_returnable(s)) {
(gdb) p s->cache_info.directives.does_client_permit_lookup
$7 = true 
github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.