New to group

1 view
Skip to first unread message

bonehead

unread,
Nov 1, 2007, 5:29:20 PM11/1/07
to rife-dev
Hi,

I was trying to use the rife continuations package to develop a simple
java example and came across a small problem.

I was trying to use a continuation to code a simple recursiveTower of
Hanoi program. Something akin to the wki example here

http://en.wikipedia.org/wiki/Tower_of_Hanoi.

I replaced the move with a pause() to break out of the recursion


hanoi(disks,...)
{
if(disks > 0)
{
hanoi(disks-1,...);
pause("Moving disk " ...);
hanoi(disks-1, ....);
}
}


When I do this it breaks out at the continuation, but upon reentry it
cauces a stack overflow problem. I am using an older version of the
rife continuaitons jar.

Any help would be greatly appreciated.

Cheers

Geert Bevin

unread,
Nov 2, 2007, 12:17:59 PM11/2/07
to rife...@googlegroups.com
Hi,

first, which version of RIFE/Continuations are you using?

Also, would you mind attaching the actual source code that you're
using so that it can be run in a very easy fashion. If there is a
problem, this drastically reduces the time to figure it out.

Thanks,

Geert

--
Geert Bevin
Terracotta - http://www.terracotta.org
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com

Frederick Isaac

unread,
Nov 2, 2007, 2:15:45 PM11/2/07
to rife...@googlegroups.com
Hi Geert,

Thanks for your prompt reply. I do have a slightly older version - I think that it is version 1.4 which I downloaded previously and compiled myself. I have not tried the newer version as yet - has there been any major api changes or should the same code work?

I am enclosing the simple example I was trying to run. It actually runs three little tests

first - a simple Tower of Hanoi (no continuations)
second - a simple pause continuation example
third - the Hanoi with continuation which does demonstrate the problem under Rife 1.4

I did modify the code from your examples, but is is mostly a juggle around to put the same code in one single object called ContinuationObject. There is a build and run unix script that just need paths setting to build and run.

Thanks very much for any help you may provide.

Cheers
jcon.jar.gz

Geert Bevin

unread,
Nov 2, 2007, 2:23:08 PM11/2/07
to rife...@googlegroups.com
Hi Frederic,

I'll look at this later, but I strongly recommend that you try with
the latest version of RIFE/Continuations, and maybe even one of the
nightly builds. Most of RIFE's development lately has gone to the
standalone continuations lib.

Best regards,

Geert

> <jcon.jar.gz>

Frederick Isaac

unread,
Nov 6, 2007, 4:32:31 AM11/6/07
to rife...@googlegroups.com
Hi Geert,
 
I am trying with a 1.4 JDK to put together a simple TestPause example. I have downloaded retroweaver and am getting the following error.
 
java.lang.NoSuchMethodError
        at com.uwyn.rife.continuations.ContinuationContext.clearActiveContext(ContinuationContext.java:114)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.run(BasicContinuableRunner.java :227)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.start(BasicContinuableRunner.java:87)
        at TestPause.testPause(TestPause.java:20)
        at mainTest.main(mainTest.java:13)
 
 
Is this due to a simple mistake. I am sorry to hassle you on this one. I really wanted to get a demo of the breaking out of recursion pattern together for teaching purposes. I have tried to rip apart your example, but the error isn't giving much away. This example I am trying is not a recursive example.
 
Any help would be much appreciated.
 
 
Cheers
 
again - sorry for having to keep coming back to you.

 

Frederick Isaac

unread,
Nov 8, 2007, 6:07:24 AM11/8/07
to rife...@googlegroups.com
Hi Geert,
 
Continuing the saga this is what I did next. Looking at the posted software for continuations it dawned on me that you are using generics as part of the new distribution.
 
I am still trying to use 1.4 so I downloaded the generics 2.4 package from sun. I ran the examples and everything checked out ok.
 
I then tried to rebuild my app with your rife 1.4 jar and still got the same error NoSuchMethodError.
 
I then tried to build the continuations package that you distribute and received error about missing class files com.uwyn.rife.tools. etc... which are not included in the source continuations distribution.
 
I then tried to extract the missing class files from your rife.jar file and used the missing ones to try to rebuild a new app.
 
I am now getting errors about
 
com.tc.object.loaders class not found.
 
Can you please offer any help as I am unable to build a working continuations application for a JDK 1.4 with your distribution.
 
Cheers
 
P.S. any feedback would be appreciated

Geert Bevin

unread,
Nov 8, 2007, 8:31:28 AM11/8/07
to rife...@googlegroups.com
Hi Frederick,

why are you not simply using the JDK 1.4 version of RIFE/Continuations?

You can download it here. This should just work, no need to do
retroweaver yourself or anything.
http://rifers.org/downloads/#rifecontinuations

Let me know how it goes.

Geert

On 08 Nov 2007, at 03:07, Frederick Isaac wrote:

> Hi Geert,
>

Frederick Isaac

unread,
Nov 8, 2007, 1:17:15 PM11/8/07
to rife...@googlegroups.com
I was originally using the 1.4 version of Rife with my JDK 1.4 and that was when the error I received was
 
java.lang.NoSuchMethodError
        at com.uwyn.rife.continuations.ContinuationContext.clearActiveContext(ContinuationContext.java:114)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.run(BasicContinuableRunner.java :227)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.start(BasicContinuableRunner.java:87)

        at TestPause.testPause(TestPause.java:20)
        at mainTest.main(mainTest.java:13)
 
 
Which was my original question. I started with the retroweaver etc. as an attempt to debug what the problem might be.
 
the example you have on your site has no main and also uses StringBuilder - this is why I started to use retroweaver and 1.4 does not support this class.
 
Like I said I had no real problems running with continuations under rife 1.4 except for the problem when I tried to use recursion. I can't seem to get 1.6 working under SDK1.4.
 
I do really appreciate your help with this though.
 
thanks

Geert Bevin

unread,
Nov 8, 2007, 4:14:57 PM11/8/07
to rife...@googlegroups.com
Hi Frederick,

I just committed a fix for this and in my local testing it should
work. The JDK 1.4 jar was badly built. Please try this version and
tell me how it works out for you:

http://rifers.org/downloads/rife/snapshots/rife-1.6.2-snapshot-20071108/rife-continuations-1.6.2-snapshot-jdk14-20071108.jar

Best regards,

Geert

On 08 Nov 2007, at 10:17, Frederick Isaac wrote:

> I was originally using the 1.4 version of Rife with my JDK 1.4 and
> that was when the error I received was
>
> java.lang.NoSuchMethodError
> at

> com
> .uwyn
> .rife
> .continuations
> .ContinuationContext.clearActiveContext(ContinuationContext.java:114)
> at
> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.run(BasicContinuableRunner.java :227)
> at
> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.start(BasicContinuableRunner.java:87)
> at TestPause.testPause(TestPause.java:20)
> at mainTest.main(mainTest.java:13)
>
>

Frederick Isaac

unread,
Nov 9, 2007, 3:50:08 AM11/9/07
to rife...@googlegroups.com
Ok still the same result Geert.
 
I am enclosing my example code so that you might help with the problem
 
 
Sorry man I would really like this to work but it seems to constantly elude me. I woule realy appreciate you help
 
Cheers
 


 
On 11/8/07, Geert Bevin <gbe...@uwyn.com> wrote:

Hi Frederick,

I just committed a fix for this and in my local testing it should
work. The JDK 1.4 jar was badly built. Please try this version and
tell me how it works out for you:

http://rifers.org/downloads/rife/snapshots/rife-1.6.2-snapshot-20071108/rife-continuations-1.6.2-snapshot-jdk14-20071108.jar

Best regards,

Geert



On 08 Nov 2007, at 10:17, Frederick Isaac wrote:

> I was originally using the 1.4 version of Rife with my JDK 1.4 and
> that was when the error I received was
>
> java.lang.NoSuchMethodError
>         at
> com
> .uwyn
> .rife
> .continuations
> .ContinuationContext.clearActiveContext(ContinuationContext.java:114)
>         at
> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.run( BasicContinuableRunner.java :227)

>         at
> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.start(BasicContinuableRunner.java:87)
>         at TestPause.testPause (TestPause.java:20)
> >         at TestPause.testPause (TestPause.java:20)
fail.jar

Geert Bevin

unread,
Nov 9, 2007, 10:15:40 AM11/9/07
to rife...@googlegroups.com
I was kind of expecting this, but I wanted to be sure since there was
effectively another problem with the packaging of the JDK 1.4 jar for
RIFE/Continuations.

I wanted to be sure, but it looks to me actually that you have a
classpath issue. Are you sure that you have no classes lingering
around from the version that you compiled yourself, or maybe an older
RIFE/Continuations jar? Are you maybe mixing an old full RIFE jar with
a new RIFE/Continuations jar. I'm thinking this because the method
that is missing is really not there with that argument, and
BasicContinuableRunner doesn't call it with that at all.

> <fail.jar>

Frederick Isaac

unread,
Nov 10, 2007, 6:07:20 AM11/10/07
to rife...@googlegroups.com
Hi,
 
I just ran again with a different option and got the following error
 
java.lang.NoSuchMethodError: java.lang.ThreadLocal: method remove()V not found
        at com.uwyn.rife.continuations.ContinuationContext.clearActiveContext(ContinuationContext.java:112)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.run (BasicContinuableRunner.java:225)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.start(BasicContinuableRunner.java:85)
        at TestPause.testPause(TestPause.java:23)
        at mainTest.main (mainTest.java:17)
 
 
This does indicate that the problem is that a call is being made to ThreadLocal.remove() which is not a part of JDK1.4 it was introduced in 1.5.
 
I also triple checked my classpath and everything seems to check out ok.
 
Does this help?
 
Again, really appreciate any help you can offer with this.
 
Cheers

Geert Bevin

unread,
Nov 10, 2007, 5:46:59 PM11/10/07
to rife...@googlegroups.com
Hi Frederic,

sorry for these problems, JDK 1.4 support is something that I haven't
really tested in a while since there wasn't much demand for it
anymore. I made some bugfixes and added a dedicated test run to the
ant build to ensure that the testsuite for RIFE/Continuations compiles
and runs without JDK 1.4.

You can download the latest jar here:

http://rifers.org/downloads/rife/snapshots/rife-1.6.2-snapshot-20071110/rife-continuations-1.6.2-snapshot-jdk14-20071110.jar

Let me know how it goes.

Take care,

Geert

On 10 Nov 2007, at 03:07, Frederick Isaac wrote:

> Hi,
>
> I just ran again with a different option and got the following error
>
> java.lang.NoSuchMethodError: java.lang.ThreadLocal: method remove()V
> not found
> at

> com
> .uwyn
> .rife
> .continuations

> .ContinuationContext.clearActiveContext(ContinuationContext.java:112)
> at
> com.uwyn.rife.continuations.basic.BasicContinuableRunner.run
> (BasicContinuableRunner.java:225)
> at

Frederick Isaac

unread,
Nov 11, 2007, 7:25:49 PM11/11/07
to rife...@googlegroups.com
That seems to have done the trick.

Thank you very much for looking into this and continuing to support 1.4.
I appreciate it very much.

Do you have any plans to post the source for 1.4 along with the 1.6 source?

Anyway I can now try my recursive tower of Hanoi with continuations.
I hope it works so I can try some more complicated recursive work.

I like the new features of the 1.6 api. I am looking forward to using them

Cheers again

Freddy

Geert Bevin

unread,
Nov 11, 2007, 8:52:38 PM11/11/07
to rife...@googlegroups.com
> That seems to have done the trick.
>
> Thank you very much for looking into this and continuing to support
> 1.4.
> I appreciate it very much.

Cool, glad it worked this time.

> Do you have any plans to post the source for 1.4 along with the 1.6
> source?

It's all the same source repository. So yeah, it is now already
available from SVN.

> Anyway I can now try my recursive tower of Hanoi with continuations.
> I hope it works so I can try some more complicated recursive work.

Let me know how it works, I'll help you track down problems if you run
into them.

Take care,

Geert

Frederick Isaac

unread,
Nov 21, 2007, 3:20:26 AM11/21/07
to rife...@googlegroups.com
Hi again,
 
Thanks again for the help earlier.
 
Well mixed news and a couple of questions.
 
I have determined that it only works if I run under 1.4 with the -classic option, otherwise it crashes the jvm and forces a core dumped which is stopped in an infinite loop. Bug in the jvm or some other problem? I didn't experience this under the earlier rife 1.4 always run with JDK1.4 hotspot no problems.
 
How can the execute method of the class with the continuation be made anything other than static. It seems to throw an exception if this is the case.
 
Can the execute method be passed parameters?
 
Cheers again
 
any help is really appreciated.
 
Freddy
 


 

Geert Bevin

unread,
Nov 21, 2007, 6:01:49 AM11/21/07
to rife...@googlegroups.com
Hi Frederick,

> I have determined that it only works if I run under 1.4 with the -
> classic option, otherwise it crashes the jvm and forces a core
> dumped which is stopped in an infinite loop. Bug in the jvm or some
> other problem? I didn't experience this under the earlier rife 1.4
> always run with JDK1.4 hotspot no problems.

This is certainly a JDK bug, core dumps always are. However, it could
be that some byte-code instructions causes this bug to create a
segfault instead of having proper error messages for this. There are
several ways to track this down, the easiest is to try to run the same
code on another JDK or even a later version, just to see if that
works. you can also try to reproduce the segfault with the smallest
possible class. If you send me that, I can look at the byte code to
see what could be the cause and maybe figure out a workaround.

> How can the execute method of the class with the continuation be
> made anything other than static. It seems to throw an exception if
> this is the case.

What is the exception? The execute method should actually not be static.

> Can the execute method be passed parameters?

Yes it can, set this up with the http://rifers.org/docs/api/com/uwyn/rife/continuations/ContinuationConfigInstrument.htmlclass
. You'll have to write the proper runner logic to provide the
arguments to the entry method. The easiest way to do this is by
extending BasicContinuableRunner and overridding the
executeContinuable method.

Hope this helps,

Geert

Frederick Isaac

unread,
Nov 22, 2007, 3:10:53 AM11/22/07
to rife...@googlegroups.com
Hi again,
 
The core dump is a SIGBUS. On my platform this generally means that there are too many mappings to a page.
I do have access to another JDK 1.4 as it requires another platform which would be AIX. As soon as I have tested I will confirm with you.
 
Sorry I didn't mean to gie the impression that the execute method was static. I meant to ask if the inner class which contains the execute method is required to be static. If not I get the exception
 
java.lang.InstantiationException: TestPause$innerPauseInWhile
        at java.lang.Class.newInstance0(Class.java:291)
        at java.lang.Class.newInstance(Class.java:259)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.run(BasicContinuableRunner.java :172)
        at com.uwyn.rife.continuations.basic.BasicContinuableRunner.start(BasicContinuableRunner.java:85)

        at TestPause.testPause(TestPause.java:23)
        at mainTest.main(mainTest.java:17)
 
I am including the example which is the simplest case I can give you. The jar has both the .java and .class files as created by my compiler.
 
Thanks very much for all your help and thanks for the advice I will try to build an example that takes parameters.
 
Cheers
simple_example.jar

Geert Bevin

unread,
Nov 23, 2007, 4:54:54 AM11/23/07
to rife...@googlegroups.com
Which JDK version are you using exactly? Seems there are many reports
of such a core dump which has been fixed in later versions of the 1.4
JDK: http://bugs.sun.com/bugdatabase/search.do?process=1&keyword=SIGBUS

Is it possible for you to upgrade?

Maybe search the bug database with more detailed information from the
core dump itself, there could be a similar issue with possibly a fix/
workaround.

On 22 Nov 2007, at 09:10, Frederick Isaac wrote:

> Hi again,
>
> The core dump is a SIGBUS. On my platform this generally means that
> there are too many mappings to a page.
> I do have access to another JDK 1.4 as it requires another platform
> which would be AIX. As soon as I have tested I will confirm with you.
>
> Sorry I didn't mean to gie the impression that the execute method
> was static. I meant to ask if the inner class which contains the
> execute method is required to be static. If not I get the exception
>
> java.lang.InstantiationException: TestPause$innerPauseInWhile
> at java.lang.Class.newInstance0(Class.java:291)
> at java.lang.Class.newInstance(Class.java:259)
> at

> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.run(BasicContinuableRunner.java :172)


> at
> com
> .uwyn
> .rife
> .continuations

> <simple_example.jar>

Geert Bevin

unread,
Nov 26, 2007, 5:31:35 AM11/26/07
to rife...@googlegroups.com
Hi,

this is normal since the basic continuations runner uses the default
constructor to create a new instance of each continuation class. If
this is a non static inner class, this can't be done.

HTH,

Geert

> Sorry I didn't mean to gie the impression that the execute method
> was static. I meant to ask if the inner class which contains the
> execute method is required to be static. If not I get the exception
>
> java.lang.InstantiationException: TestPause$innerPauseInWhile
> at java.lang.Class.newInstance0(Class.java:291)
> at java.lang.Class.newInstance(Class.java:259)
> at

> com
> .uwyn
> .rife
> .continuations
> .basic.BasicContinuableRunner.run(BasicContinuableRunner.java :172)


> at
> com
> .uwyn
> .rife
> .continuations

> <simple_example.jar>

Frederick Isaac

unread,
Nov 26, 2007, 1:17:27 PM11/26/07
to rife...@googlegroups.com
hi,

Just tried the code on another JDK 1.4 and it worked in both classic and non-classic mode, so you were right it must be my jvm.

thanks for all the help - I will move to another system with a different jvm and try it there or just continue in class mode :-)

cheers

Frederick Isaac

unread,
Jan 10, 2008, 1:11:42 PM1/10/08
to rife...@googlegroups.com
Hi Geert,
 
I moved to a Solaris 10.2 and moved up to JDK 1.5 and the newer version of the continuations package.
 
If you remember I was attempting to use recursion and am still running into stack overflow problems even with the new version.
 
the problem seems to be in calling recursively after the pause() it re-enters the execute after the pause() and not at the start of the function which means that the basis is never evaluated.
 
Hope you have some time to help me out with this one.
 
Happy New Year and Cheers
Reply all
Reply to author
Forward
0 new messages