-
Notifications
You must be signed in to change notification settings - Fork 844
Description
@d2r and I have seen the following stack in production. We believe it is due to PR #2123
[ 0 ] traffic_server Ptr<IOBufferBlock>::get() const ( Ptr.h:150 )
[ 1 ] traffic_server MIOBuffer::write(IOBufferReader*, long, long) ( IOBuffer.cc:138 )
[ 2 ] traffic_server HttpTunnel::copy_partial_post_data() ( HttpTunnel.cc:1701 )
[ 3 ] traffic_server HttpTunnel::producer_run(HttpTunnelProducer*) ( HttpTunnel.cc:1005 )
[ 4 ] traffic_server HttpTunnel::tunnel_run(HttpTunnelProducer*) ( HttpTunnel.cc:800 )
[ 5 ] traffic_server HttpSM::do_setup_post_tunnel(HttpVC_t) ( HttpSM.cc:5825 )
[ 6 ] traffic_server HttpSM::tunnel_handler_for_partial_post(int, void*) ( HttpSM.cc:3675 )
[ 7 ] traffic_server HttpSM::main_handler(int, void*) ( HttpSM.cc:2720 )
[ 8 ] traffic_server Continuation::handleEvent(int, void*) ( I_Continuation.h:153 )
[ 9 ] traffic_server HttpTunnel::main_handler(int, void*) ( HttpTunnel.cc:1665 )
[ 10 ] traffic_server Continuation::handleEvent(int, void*) ( I_Continuation.h:153 )
[ 11 ] traffic_server write_signal_and_update ( UnixNetVConnection.cc:175 )
[ 12 ] traffic_server write_signal_done ( UnixNetVConnection.cc:217 )
[ 13 ] traffic_server write_to_net_io ( UnixNetVConnection.cc:564 )
[ 14 ] traffic_server write_to_net ( UnixNetVConnection.cc:416 )
[ 15 ] traffic_server NetHandler::mainNetEvent(int, Event*) ( UnixNet.cc:516 )
[ 16 ] traffic_server Continuation::handleEvent(int, void*) ( I_Continuation.h:153 )
[ 17 ] traffic_server EThread::process_event(Event*, int) ( UnixEThread.cc:122 )
[ 18 ] traffic_server EThread::execute() ( UnixEThread.cc:266 )
[ 19 ] traffic_server spawn_thread_internal ( Thread.cc:85 )
[ 20 ] libpthread-2.12.so start_thread ( :undefined )
HttpSM::tunnel_handler_for_partial_post calls tunnel.deallocate_buffers(), which now clears ua_buffer_reader out of postbuf. But we don't clear/free postbuf on this path, so when HttpTunnel::producer_run calls allocate_redirect_postdata_buffers, it does not reallocate postbuf and reset the ua_buffer_reader field. So very quickly it tries to dereference against the null reader object and dies.
In our stack the WRITE_COMPLETE event is being processed.
I'm not clear how best to fix this. Should HttpSM::tunnel_handler_for_partial_post also be calling deallocate_redirect_postdata_buffers? Should we merge the two deallocate buffer calls if they should always be called together?