JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for STARDEV Archives


STARDEV Archives

STARDEV Archives


STARDEV@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

STARDEV Home

STARDEV Home

STARDEV  February 2009

STARDEV February 2009

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: JNIAST threads

From:

"Peter W. Draper" <[log in to unmask]>

Reply-To:

Starlink development <[log in to unmask]>

Date:

Tue, 24 Feb 2009 18:18:52 +0000

Content-Type:

TEXT/PLAIN

Parts/Attachments:

Parts/Attachments

TEXT/PLAIN (129 lines)

On Tue, 24 Feb 2009, Mark Taylor wrote:

>> On Tue, 24 Feb 2009, Mark Taylor wrote:
>>
>>>> Don't see any updates to JNIAST, did you mean to merge them from the
>>>> development branch?
>>>
>>> ack, you're right.  Try again (8537).
>>
>> Well, that error message has gone away, but there's clearly something else
>> going on. What I occasionally see are the SPLAT plot windows going blank,
>> that's no visible UI at all, but clearly no CPU is being used. So you've got
>> to suspect some kind of deadlock. Running up a debugger and attaching to the
>> process I can see two likely threads that show:
>>
>>   #0  0x00002b33f4b24b04 in __lll_lock_wait () from /lib/libpthread.so.0
>>   #1  0x00002b33f4b201a0 in _L_lock_102 () from /lib/libpthread.so.0
>>   #2  0x00002b33f4b1faae in pthread_mutex_lock () from /lib/libpthread.so.0
>>   #3  0x00002aaac2d754cf in ManageLock (this=0x2aaac0413d98, mode=1,
>>       extra=1, fail=0x412a4400, status=0x412a4524) at object.c:2354
>>   #4  0x00002aaac2baa833 in ManageLock (this_object=0x2aaac0413df8,
>>       mode=1, extra=1, fail=0x412a4400, status=0x412a4524) at frame.c:6162
>>   #5  0x00002aaac2b40d69 in ManageLock (this_object=0x2aaac0413df8,
>>       mode=1, extra=1, fail=0x412a4400, status=0x412a4524) at cmpframe.c:3936
>>   #6  0x00002aaac2bbc55a in ManageLock (this_object=0x2aaac59edc38,
>>       mode=1, extra=1, fail=0x412a4400, status=0x412a4524) at frameset.c:5623
>>   #7  0x00002aaac2d74e7f in astLockId_ (this_id=0x148ee1, wait=1,
>>       status=0x412a4524) at object.c:6060
>>   #8  0x00002aaac2aed7b4 in jniastLock (ast_objs=0x2aaabd191740) at
>>       jniast.c:441
>>   #9  0x00002aaac2b0a598 in Java_uk_ac_starlink_ast_Mapping_tran2
>>       (env=0x2aaac83bad98, this=0x412a4610, npoint=4, jXin=0x412a4600,
>>       jYin=0x412a45f8, forward=0 '\0') at Mapping.c:407
>>   #10 0x00002aaaab7a16cf in ?? ()
>>   #11 0x00000000412a45a0 in ?? ()
>>   #12 0x00002b33f59f0950 in typeArrayKlass::allocate () from
>>       /loc/pwdc/pdraper/jvms/jdk1.6.0_07/jre/lib/amd64/server/libjvm.so
>>   #13 0x00002aaaab795009 in ?? ()
>>   #14 0x0000000000000000 in ?? ()
>>
>> and:
>>
>>   #0  0x00002b33f4b24b04 in __lll_lock_wait () from /lib/libpthread.so.0
>>   #1  0x00002b33f4b201a0 in _L_lock_102 () from /lib/libpthread.so.0
>>   #2  0x00002b33f4b1faae in pthread_mutex_lock () from /lib/libpthread.so.0
>>   #3  0x00002aaac2d75499 in ManageLock (this=0x2aaac0413d98, mode=1,
>>       extra=1, fail=0x41724d90, status=0x41724e78) at object.c:2332
>>   #4  0x00002aaac2baa833 in ManageLock (this_object=0x2aaac0413dd0,
>>       mode=1, extra=1, fail=0x41724d90, status=0x41724e78) at frame.c:6162
>>   #5  0x00002aaac2b40d69 in ManageLock (this_object=0x2aaac0413dd0,
>>       mode=1, extra=1, fail=0x41724d90, status=0x41724e78) at cmpframe.c:3936
>>   #6  0x00002aaac2d74e7f in astLockId_ (this_id=0x101b80, wait=1,
>>       status=0x41724e78) at object.c:6060
>>   #7  0x00002aaac2aed7b4 in jniastLock (ast_objs=0x2aaac565f030) at
>>       jniast.c:441
>>   #8  0x00002aaac2aed358 in jniastMakeObject (env=0x2aaabc614d98,
>>       objptr=0x101b80) at jniast.c:364
>>   #9  0x00002aaac2affd65 in Java_uk_ac_starlink_ast_FrameSet_getFrame
>>       (env=0x2aaabc614d98, this=0x41725010, iframe=-1) at FrameSet.c:91
>>   #10 0x00002aaaab7a16cf in ?? ()
>>   #11 0x0000000041724fc0 in ?? ()
>>   #12 0x0000000041724f98 in ?? ()
>>   #13 0x0000000041724fa0 in ?? ()
>>   #14 0x0000000041724fa8 in ?? ()
>>   #15 0x0000000000000000 in ?? ()
>>
>> Sure looks like a deadlock. If so cannot say I'm surprised, having a thread
>> that loads data and another that re-draws the UI in response to new data
>> running concurrently seems likely to cause this.
>
> In principle it should (I believe) be OK.  At the JNIAST level, every
> time I lock objects I do it in a defined order: ascending order of
> AstObject * pointer.  All my locking is done like this:
>
>    (no objects locked)
>    work out which objects will be required
>    lock them all in order
>    do AST stuff
>    unlock them all
>    (no objects locked)
>
> from the discussion of deadlocks at
>
>   http://en.wikipedia.org/wiki/Dining_philosophers_problem#Resource_hierarchy_solution
>
> I believe that this is in principle sufficient to ensure that no deadlocks
> occur.  However, thinking about it, there may be complications:
>
>   1. Does the AstObject * pointer uniquely identify an object to be
>      locked?  I know AST is tricky, but I'm not quite sure how tricky.
>      If the AstPointer * is not actually the thing which identifies
>      the locked object (e.g. different AstPointer * values can point to
>      the same lockable object) this won't do the trick.
>
>   2. I think that astLock(ptr,1), as well as acquiring a lock on the
>      object ptr, also acquires locks on all the objects contained within
>      it.  If those locks are not acquired in order, and moreover in
>      the same order that I'm using outside of AST, the scheme will fail.
>
> My guess is that fixing up these 1 or 2 points is somewhere between
> difficult and impossible (but it's worth David bearing these
> considerations in mind in case other threaded-AST users attempt to
> do something similar).
>
> So, unless David says different:

Maybe there's a bug in the ordering of locks, but given that AST deals 
with graphs of objects to lock, the order might be a bit fuzzy so 2 looks 
likely.

>> Maybe it's back to plan A?
>
> ... I give in.  I'll re-instate the per-AST monolithic lock
> (#define JNIAST_THREADS 0).
>
> Given that, do we have a working SPLAT?

Yes, with that change SPLAT passes all the same tests that produce the 
deadlock.

> Note, I'm still doing JNIAST updates for the AST 4.1->5.1 upgrades, so 
> it's not worth doing lib rebuilds and super-exhaustive tests just yet.

Understood.

Cheers,

Peter.

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
January 2023
December 2022
July 2022
June 2022
April 2022
March 2022
December 2021
October 2021
July 2021
April 2021
January 2021
October 2020
September 2020
August 2020
May 2020
November 2019
October 2019
July 2019
June 2019
February 2019
January 2019
December 2018
November 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
December 2017
October 2017
August 2017
July 2017
May 2017
April 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
October 2015
September 2015
August 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
2004
April 2003
2003


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager