| Message |
 |
Date: 2007-06-20 05:39
Sender: Sylvain Joyeux
The patch works. Thanks. |
Date: 2007-06-19 01:38
Sender: Nobuyoshi Nakada
Oops, I missed to "Check to Upload & Attach File." |
Date: 2007-06-18 08:38
Sender: Sylvain Joyeux
I think you forgot to attach the patch ;-) |
Date: 2007-06-18 06:34
Sender: Nobuyoshi Nakada
Is this patch OK? |
Date: 2007-06-13 11:46
Sender: Sylvain Joyeux
OK ... Found something
I have a question about mutex_relock. How it is possible
that the thread status in mutex_relock (which is called in
an ensure block) is something different than RUNNABLE. I
found that my problem was that the thread status is
TO_KILL.
The thread *is* nonetheless running, and is processing
ensure blocks. In particular, it processes mutex_relock in
the ensure of wait_condvar and *then* processes
mutex_unlock in the ensure block of rb_mutex_synchronize.
Since the status was TO_KILL, mutex_relock did *not*
relock and mutex_unlock complains. I personally don't see
the point of mutex_relock. Could you explain ?
|
Date: 2007-06-13 11:16
Sender: Sylvain Joyeux
It seems that the problem is related to exception
management. The error occurs when Thread#raise is used.
Maybe it interrupts an ensure function.
The problem with multi-threading is that reproducing
errors is very often NOT unit-testable as it is very much
context-dependent. Your test, for instance, does not take
into account the various context combinations the code can
encounter
The only way to find this kind of bug is to run real MT
apps (what I did), and then to review the code (what I
also did for 1.8.6, I have unfortunately no time for this
right now)
Since it is the second consecutive Ruby release that
thread support is broken, and since it is not properly
unit-testable, I'll advise that *any* change to thread.c
is reviewed by *at least* two persons before commit. What
do you think ?
|
Date: 2007-06-13 06:47
Sender: Nobuyoshi Nakada
Can't you show complete small code that can reproduce the
problem?
This seems to work.
./ruby -e '
require "thread"
mutex = Mutex.new
cv = ConditionVariable.new
Thread.new{sleep 1; cv.signal}
mutex.synchronize do
cv.wait(mutex)
end' |