harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Weldon Washburn" <weldon...@gmail.com>
Subject Re: [drlvm][threading] Possible race condition in implementation of conditional variables?
Date Sun, 15 Oct 2006 18:49:00 GMT
After thinking about it a while, how about the following course of action:

1)
First phase is to modify hysem_wait() and any other hy.... blocking
functions to test if, in fact, the thread is in suspend enabled mode.  If
the thread is not,  do something like a printf("WARNING: root set
enumeration is unstable, hytsem.cpp line #285\n");  Then do a
non-destructive stack unwind and printf a stack trace

An even better idea would be to log the printf's out to a file that can
later be retrieved.

2)
Second phase.  Analyze the code paths that lead to the enable/disable
problems.  Are there fundamental design flaws?  Implementation flaws?

3)
Third phase.  Assume the above turns up easy to fix bugs and minor
architectural issues.  And that these issues are settled.  Then commit a mod
to svn that will cause the system to do an assert(0); in debug mode and exit
w/ stack trace in release mode.

Artem,
Does it make sense for you to create a patch that does the above??


On 10/13/06, Artem Aliev <artem.aliev@gmail.com> wrote:
>
> A classloader and some other components assume that semaphores and
> latches does not reset suspend disable count and some time ago latches
> and semaphores work this way.
> A java monitor ,in reverse, resets the suspend disable status in
> monitorEnter and monitor_wait command, and DRLVM takes care about it.
> It looks like someone changed the behavior of semaphores to be
> compatible with the monitors.
>
> I agree with Xiao-Feng: the sleeping thread should be in suspend_enable
> mode.
> So I vote for leaving the current threading code as is but checking
> DRLVM for a code that not ready for the new behavior.
>
> For example by putting assert(gc enabled ==  true() and checking failed
> places.
>
> Thanks
> Artem
>
>
> On 10/13/06, Xiao-Feng Li <xiaofeng.li@gmail.com> wrote:
> > GC should be enabled in waiting state. In case that a GC can happen,
> > the code should do bookkeeping to guarantee the correctness.
> >
> > Thanks,
> > xiaofeng
> >
> > On 10/13/06, Evgueni Brevnov <evgueni.brevnov@gmail.com> wrote:
> > > Hi,
> > >
> > > I do the following:
> > >
> > > hythread_suspend_disable();
> > > <do unsafe actions>
> > > hysem_wait(semaphore);
> > > <do unsafe actions>
> > > hythread_suspend_enable();
> > >
> > > By saying hythread_suspend_disable(); I expect the thread can't be
> > > suspended until hythread_suspend_enable() is called. But hysem_wait()
> > > resets disabled mode and enables thread suspension. As a result GC can
> > > happen when it must not. hysem_wait is based on conditional variables
> > > so the same can happen when conditional variables is used.
> > >
> > > Do you see the problem here? Or I miss something?
> > >
> > > Thanks
> > > Evgueni
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Weldon Washburn
Intel Middleware Products Division

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message