Repository navigation
Closed
Description
We got this crash on 8.0.x. This looks pretty similar to #4158. So #4158 (adding null check) could be workaround fix. But it looks like there is a race on shutdown which we should fix.
[ 0 ] libc-2.12.so __libc_waitpid ( :undefined )
[ 1 ] traffic_server crash_logger_invoke ( Crash.cc:165 )
[ 2 ] libc-2.12.so 0x2b0b38dfd570 ( :undefined )
[ 3 ] traffic_server Http2ConnectionState::release_stream(Http2Stream*) ( Http2ConnectionState.cc:1261 )
[ 4 ] traffic_server Http2Stream::destroy() ( Http2Stream.cc:730 )
[ 5 ] traffic_server Http2Stream::terminate_if_possible() ( Http2Stream.cc:380 )
[ 6 ] traffic_server Http2Stream::main_event_handler(int, void*) ( Http2Stream.cc:131 )
[ 7 ] traffic_server handleEvent ( I_Continuation.h:160 )
[ 8 ] traffic_server EThread::process_event(Event*, int) ( UnixEThread.cc:131 )
[ 9 ] traffic_server EThread::process_queue(Queue<Event, Event::Link_link>*, i... ( UnixEThread.cc:170 )
[ 10 ] traffic_server EThread::execute_regular() ( UnixEThread.cc:230 )
[ 11 ] traffic_server spawn_thread_internal ( Thread.cc:85 )
[ 12 ] libpthread-2.12.so start_thread ( :undefined )
trafficserver/proxy/http2/Http2ConnectionState.cc
Lines 1257 to 1265 in 8c50c75
| if (fini_received) { | |
| // We were shutting down, go ahead and terminate the session | |
| // this is a member of Http2ConnectionState and will be freed | |
| // when ua_session is destroyed | |
| ua_session->destroy(); | |
| // Can't do this because we just destroyed right here ^, | |
| // or we can use a local variable to do it. | |
| // ua_session = nullptr; |
Activity
zwoop commentedon Oct 29, 2018
Here's a more detailed stack trace:
zwoop commentedon Dec 6, 2018
I think this was fixed in a639581. I'm going to close this.
masaori335 commentedon Dec 13, 2018
Unfortunately, we and @zizhong still see this crash with a639581.
zwoop commentedon Dec 20, 2018
Yeh, the crasher is less frequent, but still happens. Seems we just reduce the window of the race condition?
zwoop commentedon Jan 25, 2019
Masaori added a "history" feature, which I'm including here:
From frame #3 (Http2ConnectionState::release_stream):
and from frame #4 (Http2Stream::destroy):
zwoop commentedon Feb 5, 2019
Here's the updated trace / history from latest crash / build:
masaori335 commentedon Feb 5, 2019
FWIW, this is history of Http2ClientSession
masaori335 commentedon Feb 6, 2019
The history gave us clue! Masakazu and I found below.
TLDR;
Calling
vc->add_to_keep_alive_queue()(line 1253) madeua_sessionnullptrwith heavy traffic.trafficserver/proxy/http2/Http2ConnectionState.cc
Lines 1246 to 1261 in ce706ce
Details
It looks like below was happened
Http2ConnectionState::release_stream()did null check ofua_sessionUnixNetVConnection::add_to_keep_alive_queue()is calledNetHandler::manage_keep_alive_queue()is calledNetHandler::manage_keep_alive_queue()start closing inactive connections withVC_EVENT_INACTIVITY_TIMEOUT (105).Http2ClientSession::main_event_handler().Http2ClientSession::main_event_handler()free itself.Http2ClientSession::free()callsHttp2ConnectionState::destroy()ua_sessionbecamenullptrReproduction
I could reproduced similar crash in local box with small
proxy.config.net.max_connections_inand h2load. The call stack which I could reproduce is https://paste.apache.org/hd4eConditions
This crash could happen only if
total_connections_in > max_connections_per_thread_ininNetHandler::manage_keep_alive_queue().trafficserver/iocore/net/UnixNet.cc
Lines 610 to 612 in ce706ce
From the core file, when ATS crashed, the condition was satisfied.
I'm going to open PR to avoid this.
BTW, the @dmorilha's first patch (adding null check) was correct in some way :p
zizhong commentedon Feb 6, 2019
Nicely done! @masaori335 @maskit
dmorilha commentedon Feb 8, 2019
nice! are we back porting this to 7.1 ?
zwoop commentedon Feb 8, 2019
Yeh, seems like a reasonable candidate for 7.1.x. Is anyone testing H2 on 7.1 ?
Mark H2 connection inactive only if it is NOT shutting down