[
https://issues.apache.org/jira/browse/TS-4507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15360171#comment-15360171
]
ASF GitHub Bot commented on TS-4507:
------------------------------------
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 <[email protected]>
Date: 2016-07-02T13:10:11Z
TS-4507: Fix SSN and TXN hook ordering.
----
> It is still possible for SSN_CLOSE hook to be called before TXN_CLOSE hook
> --------------------------------------------------------------------------
>
> Key: TS-4507
> URL: https://issues.apache.org/jira/browse/TS-4507
> Project: Traffic Server
> Issue Type: Bug
> Components: Core
> Reporter: Susan Hinrichs
> Assignee: Susan Hinrichs
> Fix For: 7.0.0
>
>
> One of our plugins will occasionally crash. It appears there is still a path
> for HTTP2 that has the SSN_CLOSE hook close before the TXN_CLOSE hook.
> Working through solutions that delay the SSN_CLOSE hook until after all the
> TXN_CLOSE hooks, but does not lose the SSN_CLOSE.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)