TS-2271: Let TSHttpTxnReenable work gracefully when it's called from an unexpected thread (this_ethread() returns NULL).
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d706b7d6 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d706b7d6 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d706b7d6 Branch: refs/heads/5.0.x Commit: d706b7d6478ff8b5a37b1422b3ad45739c10a5e9 Parents: 698db8b Author: Heikki Hannikainen <he...@hes.iki.fi> Authored: Mon Dec 30 17:42:23 2013 +0200 Committer: James Peach <jpe...@apache.org> Committed: Thu Jan 2 08:39:01 2014 -0800 ---------------------------------------------------------------------- proxy/InkAPI.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d706b7d6/proxy/InkAPI.cc ---------------------------------------------------------------------- diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc index 1e8ecdf..cb31e6d 100644 --- a/proxy/InkAPI.cc +++ b/proxy/InkAPI.cc @@ -5516,10 +5516,14 @@ TSHttpTxnReenable(TSHttpTxn txnp, TSEvent event) HttpSM *sm = (HttpSM *) txnp; EThread *eth = this_ethread(); + // TS-2271: If this function is being executed on a thread which was not + // created using the ATS EThread API, eth will be NULL, and the + // continuation needs to be called back on a REGULAR thread. + // // If this function is being executed on a thread created by the API // which is DEDICATED, the continuation needs to be called back on a // REGULAR thread. - if (eth->tt != REGULAR) { + if (eth == NULL || eth->tt != REGULAR) { eventProcessor.schedule_imm(NEW(new TSHttpSMCallback(sm, event)), ET_NET); } else { MUTEX_TRY_LOCK(trylock, sm->mutex, eth);