Hi Pjotr,

Thanks for testing out the new code.  I changed the code to use of join()
to address the false positives generated by valigrind when a thread is
stopped without the pthread_join() that it expects.  Addressing this false
positive made it easier to determine the actual race condition, but...
unfortunately as you've found it this change has consequences - a bit like
fixing a benign compile warning only to introduce a real bug in the process.

As a long shot, could you try placing a cancel() in before the join() to
see if that addresses the deadlock.  If this doesn't address the deadlock
then re-introducing the only code is something I'll do.  It may be possible
to appease valigrind by adding the join() afterwards, but I've seen errors
in joining an already stopped thread so this might not be ideal.

BTW, what platform are you seeing this deadlock?

Robert.


On 5 November 2014 10:13, Pjotr Svetachov <pjotrsvetac...@gmail.com> wrote:

> Hi Robert,
>
> I saw that you put the new thread code on svn. I have experimented a
> little with it and it seems to produce deadlocks on application shutdown
> for us. In OperationThread::cancel you have replaced a while loop with a
> join. The problem is that the previous code was periodically calling
> _currentOperation->release() which the new code does not do.
> I think I have narrowed the problem down, there are two scenarios that can
> produce deadlocks:
>
> 1)
> OperationThread::cancel can call _currentOperation->release() when the
> operation thread is at line 396 to 399 (so it didn't set _currentOperation
> yet). This way the operation thread will be blocking on the operation it
> just got from the queue, which is not the operation that got it's release
> method called by OperationThread::cancel.
>
> 2)
> If the current operation is a barrier then the release method only
> releases threads that are waiting, it does not invalidate the barrier. So
> if the operation thread is not yet in the barrier and you call release it
> will still block when it arrives at the barrier.
>
> Cheers,
> Pjotr
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=61519#61519
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to