Github user shenzhang920 commented on the pull request:

    https://github.com/apache/trafficserver/pull/603#issuecomment-215265241
  
    Description:
    
    When calling TSContSchedule()/TSContScheduleEvery(), the passed in 
parameter TSCont have to have MUTEX; otherwise if we call 
TSContSchedule()/TSContScheduleEvery() more than once using same TSCont, only 
the first call will take effect; all the following schedule are ignored due to 
MUTEX issue.
    
    Root casue:
    
    The first time calling TSHttpSchedule() with TSCont A (and TSCont A doesn't 
have a mutex), it creates Event A, assign thread A; while calling 
EThread::schedule(), e->continuation->mutex is NULL, so "e->mutex = 
e->continuation->mutex = e->ethread->mutex;" is executed.
    Now Event A's mutex = TSCont A's mutex = thread A's mutex
    
    The second time calling TSHttpSchedule() with TSCont A, it creates Event B, 
assign thread B;
    while calling EThread::schedule(), e->continuation->mutex is NOT NULL, so 
"e->mutex = e->continuation->mutex;" is executed.
    Now Event B's mutex = TSCont A's mutex (which actually is Event A's mutex)
    
    Eventually, EventA and EventB use a same mutex which causes the second 
scheduling get ignored.



---
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