This is an automated email from the ASF dual-hosted git repository.
shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 9b78e8e Avoid cross-thread mutex conflicts
9b78e8e is described below
commit 9b78e8e270962773446d39560d5a77e7532ef84c
Author: Susan Hinrichs <[email protected]>
AuthorDate: Fri Jan 17 14:31:37 2020 +0000
Avoid cross-thread mutex conflicts
---
iocore/eventsystem/P_UnixEventProcessor.h | 2 --
iocore/eventsystem/UnixEThread.cc | 9 ++++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/iocore/eventsystem/P_UnixEventProcessor.h
b/iocore/eventsystem/P_UnixEventProcessor.h
index 2110fc1..fe89945 100644
--- a/iocore/eventsystem/P_UnixEventProcessor.h
+++ b/iocore/eventsystem/P_UnixEventProcessor.h
@@ -115,8 +115,6 @@ EventProcessor::schedule(Event *e, EventType etype)
if (e->continuation->mutex) {
e->mutex = e->continuation->mutex;
- } else {
- e->mutex = e->continuation->mutex = e->ethread->mutex;
}
e->ethread->EventQueueExternal.enqueue(e);
return e;
diff --git a/iocore/eventsystem/UnixEThread.cc
b/iocore/eventsystem/UnixEThread.cc
index 2913ba6..88f23f6 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -34,6 +34,8 @@
#include <sys/eventfd.h>
#endif
+#include <typeinfo>
+
struct AIOCallback;
#define NO_HEARTBEAT -1
@@ -108,7 +110,7 @@ void
EThread::process_event(Event *e, int calling_code)
{
ink_assert((!e->in_the_prot_queue && !e->in_the_priority_queue));
- MUTEX_TRY_LOCK(lock, e->mutex, this);
+ WEAK_MUTEX_TRY_LOCK(lock, e->mutex, this);
if (!lock.is_locked()) {
e->timeout_at = cur_time + DELAY_FOR_RETRY;
EventQueueExternal.enqueue_local(e);
@@ -120,6 +122,11 @@ EThread::process_event(Event *e, int calling_code)
Continuation *c_temp = e->continuation;
// Make sure that the continuation is locked before calling the handler
+ // Give a heads up if we are processing through a continuation without a
mutex
+ if (!e->mutex) {
+ Warning("event processing for continuation %s without a mutex",
typeid(*c_temp).name());
+ }
+
// Restore the client IP debugging flags
set_cont_flags(e->continuation->control_flags);