bneradt opened a new pull request, #12874:
URL: https://github.com/apache/trafficserver/pull/12874

   This is a revised version of PR #12803 which was reverted in PR #12841 
because it lacked the idempotent cancel guard, causing its own set of crashes.
   
   There is a race between NetAcceptAction::cancel() and 
NetAccept::acceptEvent() where the server pointer could be dereferenced after 
the NetAccept object was deleted. Thread A calls cancel(), which sets 
cancelled=true via Action::cancel(). Thread B running acceptEvent() sees 
cancelled==true and deletes the NetAccept (including the embedded Server). 
Thread A then calls server->close() on freed memory.
   
   This is fixed by making the server pointer in NetAcceptAction atomic and 
using exchange(nullptr) so only one thread can obtain and close the server. 
Additionally, cancel() is made idempotent by checking !cancelled before calling 
Action::cancel(), which prevents ink_assert(!cancelled) assertion failures when 
cancel is called from both external callers (TSActionCancel) and internal error 
paths (acceptEvent, acceptFastEvent, acceptLoopEvent).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to