Hi Andrew,

Did you get a chance to see the solution posted by Andres?
http://lists.neo4j.org/pipermail/user/2010-September/005046.html
Check out the patched code in the gist he linked to in that email:
http://gist.github.com/594707

The problem with the example you were running was that the finally-block
contained failing code. This prevented the entire finally-block from
completing, more specifically it prevented shutdown from being invoked.

GroovyConsole will keep running even after a script it's executing has
failed. Combined with the fact that the scripts that GroovyConsole executes
run in the same JVM as GroovyConsole itself (and thus all scripts run in the
same JVM), this means that the Neo4j kernel instance from the first
execution (that was not shut down due to failure) will still be around when
you try to start the second execution.

The problem in the original code was that if you omitted the tx.success()
call the transaction would roll back. This would mean that the nodes created
in the try-block no longer exist. When the code in the finally-block tries
to operate on the references to those nodes it will fail since these nodes
don't exist. The exception thrown by this failure will prevent the execution
of the next statement, the call to shutdown. Thus rendering the problem you
have experienced.

Andres has nicely fixed this problem in his updated version of your script
by having the shutdown invocation in its own, outer, finally-block. This
ensures that shutdown is always invoked, regardless of how the script
terminates.

Cheers,
Tobias

On Fri, Sep 24, 2010 at 3:16 AM, Andrew Grealy <iag...@yahoo.com> wrote:

> Hi Mattias,
>
> I think it needs looking into to, it's a Bug.
>
> I tested the same application in a pure java application - no problem
> whatsoever.
>
> I do the code in groovy script, make a bug and Wham....cannot access my
> graph after it crashes out.
>
> The groovy script would not keep the JVM up. I change the graph to a new
> name and things work again.
>
> It is a lock that when groovy crashes out, you cannot get into your graph
> again.
>
> Once again, doing the same code in java and crashing it, I see a recovery
> message, and it comes up nicely.
>
> Groovy isn't doing this recovery.
>
> I would like to use Groovy as I think it's going to be a nice fit for
> writing graph code.  Peter also has he same problem using gremlin.
>
> cheers,
> ag
>
> >The cause of this problem (for the OverlappingFileLockException) is that
> > there's another Neo4j kernel instance already running withing the same
> JVM
> > for that particular store. I also improved the exception to say that.
>
> 2010/9/23 Andrew Grealy <iaglyw at yahoo.com>
>
> > Hi All,
> >
> > I have been on the learning path for Neo4J. I came across a problem
> people
> > are experiencing.
> >
> > If you write groovy scripts to learn how to use Noe4j, then if they bomb
> > out you are left with the 'unable to lock store problem'.
> >
> > I was playing with groovy code from:
> > http://groovyconsole.appspot.com/script/245001
> > (To reproduce the problem just make a bug, such as comment out the
> > tx.success() line then re-run again)
> >
> > I then tried doing the same thing in Java, to confirm Neo4J isn't flakey.
> > Neo4J was rock solid.  This may explain why all the people answering guys
> > messages on this problem says it because you have two applications
> accessing
> > the system. (Which I can tell you only had one groovy script running at a
> > time.)
> >
> > I would like to make a suggestion have a special startup mode, that can
> > clear the state on startup. (Getting to work again, was painful).  In
> > development this would be useful, it would be an over-ride and not normal
> > operation
> >
> > cheers,
> > Andrew
> >
> >
> >
> > _______________________________________________
> > Neo4j mailing list
> > User at lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
>
>
>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <tobias.ivars...@neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to