[Click] NotifierQueue on multi-threaded Click problem.
Joonwoo Park
joonwpark81 at gmail.com
Thu Sep 13 04:45:41 EDT 2007
Unfortunately, A few hours ago I found that my test machine has gone
into hibernation.
It had worked for about 3 ~ 4 days maybe.
And I found that I can reproduce the problem in short time with
SLEEPINESS_TRIGGER=1.
IMHO, I think process_pending() still has problem.
When another thread's Task::add_pending see 'if (!_pending_nextptr)'
as FALSE, at the same time if we set it to 0, thread->add_pending()
cannot be called again (only if _pending_reschedule is FALSE).
As a result, It's seems that a routerthread go sleep forever.
I tried patch and It works fine although SLEEPINESS_TRIGGER=1. (I have
never seen before working SLEEPINESS_TRIGGER=1)
How about this?
-
Signed-off-by: Joonwoo Park <joonwpark81 at gmail.com>
lib/master.cc | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/master.cc b/lib/master.cc
index 5a56371..cef62be 100644
--- a/lib/master.cc
+++ b/lib/master.cc
@@ -370,7 +370,15 @@ Master::process_pending(RouterThread *thread)
// process the list
while (Task *t = Task::pending_to_task(my_pending)) {
my_pending = t->_pending_nextptr;
+ // when another thread's Task::add_pending see 'if (!_pending_nextptr)'
+ // as FALSE, at the same time if we set it to 0, thread->add_pending()
+ // cannot be called again (only if _pending_reschedule is 0).
+ bool lock = !t->_pending_reschedule;
+ if (lock)
+ flags = _task_lock.acquire();
t->_pending_nextptr = 0;
+ if (lock)
+ _task_lock.release(flags);
t->process_pending(thread);
}
}
-
Joonwoo Park
More information about the click
mailing list