GitHub user shinrich opened a pull request:

    https://github.com/apache/trafficserver/pull/787

    TS-4507: Fix SSN and TXN hook ordering.

    This change was motivated by dealing with ordering problems between 
SSN_CLOSE and TXN_CLOSE causing problems (crashes).  This we addressed as 
follows
      * The TXN_CLOSE is kicked off in the State Machine kill_this.  This is 
the point were we know that the TXN really is going away.  This is unchanged.  
What this patch adds is a call to transaction_done to let the ClientTransaction 
know that TXN_CLOSE has completed so the calculation about whether is it time 
to execute SSN_CLOSE or not.  As such we cannot null out ua_session early.
    
    * To support SSN_CLOSE accurately, we split the destroy logic into two 
parts: destroy and free.  Destroy commits to deleting the session and it kicks 
off the SSN_CLOSE plugin. free performs the final resource reclamation of the 
session object.
    
    In addition this PR includes the following fixes.
    
        In ProxyClientSession::state_api_callout we schedule_in 10ms in the 
future if the plugin lock is not acquired. Saw ASAN use-after-free crashes when 
the Http2ClientSession is deleted but the schedule event remains and is 
triggered. Added a schedule_event member to track this case and cancel any 
outstanding schedule events on free.
    
        Cleaned up handling regular events at the same time as plugin events. 
The original code relied on the subclasses overriding handle_api_event to 
handle the regular events, but the handler only handled the TIMEOUT event. 
Changed that to augment the subclasses' main event handler to call out to 
state_api_callout in the event of the plugin events.
    
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shinrich/trafficserver ts-4507-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/787.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #787
    
----
commit ce7f22609b169b48e4883375ec42e78996827614
Author: Susan Hinrichs <shinr...@ieee.org>
Date:   2016-07-02T13:10:11Z

    TS-4507: Fix SSN and TXN hook ordering.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to