Fwd: Re: Illegal operation exception in lock-free Stack

8 views
Skip to first unread message

Vijay Saraswat

unread,
Dec 12, 2010, 4:51:41 AM12/12/10
to Pranay Prabhakar, Olivier Tardieu, coms49...@googlegroups.com
Pranay ---

Again, please send your code that shows this problem, and tell us which version of X10 you are using.

The traceback is showing that a Latch.await is being called from within an atomic block. What I need to find out is if this a bug in the runtime (highly unlikely, but possible) or in the way you are calling some code.

Best,
Vijay

-------- Original Message --------
Subject: Re: Illegal operation exception in lock-free Stack
Date: Sat, 11 Dec 2010 18:41:57 -0500
From: Pranay Prabhakar <ppp...@columbia.edu>
Reply-To: coms49...@googlegroups.com
To: coms49...@googlegroups.com, Yoav Zibin <yoav....@gmail.com>
CC: kks...@columbia.edu


I have no atomic block which has wait, at or async.
Pranay


Quoting Yoav Zibin <yoav....@gmail.com>:

> yes, inside an atomic section some operations are not allowed:
> wait, at , async
> (because atomic sections should be as small as possible).
>
> On Sat, Dec 11, 2010 at 6:21 PM, Pranay Prabhakar   
> <ppp...@columbia.edu>wrote:
>
>>
>> I have implemented my version of the lock-free Stack. However, on calling
>> either push or pop operation I get the following error:
>>
>> x10.lang.IllegalOperationException: illegal operation exception
>> x10.lang.IllegalOperationException: illegal operation exception
>>        at x10::lang::Throwable::fillInStackTrace()
>>        at x10::lang::Activity::ensureNotInAtomic()
>>        at x10::lang::Runtime::ensureNotInAtomic()
>>        at x10::lang::Latch::await()
>>        at x10::lang::Runtime__RootFinish::waitForFinish(bool)
>>        at x10::lang::Runtime::start(x10aux::ref<x10::lang::VoidFun_0_0>,
>> x10aux::ref<x10::lang::VoidFun_0_0>)
>>        at int x10aux::template_main<x10::lang::Runtime, Stack>(int, char**)
>>        at __libc_start_main
>>        at std::ios_base::Init::~Init()
>>
>> The implementation is on the lines of lock-free Queue given in the notes.
>> Any ideas as to what I should be looking for to debug this?
>>
>>
>> Thanks,
>> Pranay
>>
>>
>>
>>
>>
>





Vijay Saraswat

unread,
Dec 13, 2010, 5:32:20 AM12/13/10
to Pranay Prabhakar, Olivier Tardieu, coms49...@googlegroups.com
On 12/12/2010 11:35 AM, Pranay Prabhakar wrote:
>
> I have two functions:
>
> public atomic def casTop(oldVal:Node, newVal:Node){
> // serial code
> }
>
> public atomic def casTop(oldVal:Node, newVal:Node){
> // serial code
>
> }
>
> within one class. If I remove the atomic qualifier and use the atomic
> key word while making the function call instead, the error goes away.
> I am attaching my code for your perusal.
>
When i tried the code you sent, I got a compilation problem (a variable
in your code was not defined). Fixing it, I got another compilation
problem that is an X10 compiler bug. See
http://jira.codehaus.org/browse/XTENLANG-2215?focusedCommentId=247419#action_247419

So thanks for unearthing this.

The work-around you have found would appear to be correct: wrap the
invocation in an atomic.

I am puzzled how this error relates to the error you reported earlier
--- the IllegalOperationException. These seem to be two very different
things..?

Best,
Vijay

> Dropping the distribution list as this is a HW code.
>
> Thanks,
>
> Pranay

Reply all
Reply to author
Forward
0 new messages