Database access from bg thread: python

18 views
Skip to first unread message

Rod Fitzsimmons Frey

unread,
Mar 2, 2012, 9:31:51 AM3/2/12
to Neo4j
Hi. I posted yesterday but I don't think I gave enough information.

I'm getting a crash when I try to create an embedded database from
python from within the consumer thread in a producer-consumer setup.
I'm sure I'm abusing the interface somehow, but I don't know how and
I'm stuck.

Here's a sample program that manifests the crash:

https://gist.github.com/1958654

Here's the dump that results:

https://gist.github.com/1958707

The same error occurs if I try to create a db instance in the
foreground thread as a global and access it from the bg thread.

Thanks for any advice/insight/help!

Some other info:

rfrey@oilers:~/dev/rowzero$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode)

rfrey@oilers:~/dev/rowzero$ python -V
Python 2.6.5

Using neo4j-community-1.6

Peter Neubauer

unread,
Mar 14, 2012, 5:40:49 PM3/14/12
to ne...@googlegroups.com
Rod,
seems you are running java7 there? Have no idea about Python, but
maybe you could switch JRE to Java6 and try again? Seems the JVM is
SegFaulting ...

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j 1.6 released                 - dzone.com/6S4K
The Neo4j Heroku Challenge   - http://neo4j-challenge.herokuapp.com/

Jacob Hansson

unread,
Mar 15, 2012, 5:42:23 AM3/15/12
to ne...@googlegroups.com
Hmm.. looks like JPype segfaults. Would have to dig into it with a debugger I think to figure out what is going on, but I'm gonna venture a guess that it is a bug.

We do test running neo4j with threads on python as part of the build though. It might help you to look at how those are set up:

https://github.com/neo4j/python-embedded/blob/master/src/test/python/threads.py

Let me know if that does not work!
--
Jacob Hansson
Phone: +46 (0) 763503395
Twitter: @jakewins

Rod Fitzsimmons Frey

unread,
Mar 15, 2012, 11:11:04 AM3/15/12
to Neo4j
Hey guys, thanks for the kind attention. I kind of left this behind
by moving over to a server instance of Neo4j and using the
neo4jrestclient python module. Solved the problem but might not be
performant enough in the future.

I agree it's a jpype problem: I just reproduced using the vanilla
jpype library, no neo4j involved. Could it have to do with the
jpype.attachThreadToJVM() call that one is supposed to execute when in
a background thread? If so, should that be the client's
responsibility, or the neo4j library's?


On Mar 15, 4:42 am, Jacob Hansson <jacob.hans...@neotechnology.com>
wrote:
> Hmm.. looks like JPype segfaults. Would have to dig into it with a debugger
> I think to figure out what is going on, but I'm gonna venture a guess that
> it is a bug.
>
> We do test running neo4j with threads on python as part of the build
> though. It might help you to look at how those are set up:
>
> https://github.com/neo4j/python-embedded/blob/master/src/test/python/...
>
> Let me know if that does not work!
>
> On Wed, Mar 14, 2012 at 10:40 PM, Peter Neubauer <
>
>
>
>
>
>
>
>
>
> peter.neuba...@neotechnology.com> wrote:
> > Rod,
> > seems you are running java7 there? Have no idea about Python, but
> > maybe you could switch JRE to Java6 and try again? Seems the JVM is
> > SegFaulting ...
>
> > Cheers,
>
> > /peter neubauer
>
> > G:  neubauer.peter
> > S:  peter.neubauer
> > P:  +46 704 106975
> > L:  http://www.linkedin.com/in/neubauer
> > T:   @peterneubauer
>
> > Neo4j 1.6 released                 - dzone.com/6S4K
> > The Neo4j Heroku Challenge   -http://neo4j-challenge.herokuapp.com/
>
> > On Fri, Mar 2, 2012 at 3:31 PM, Rod Fitzsimmons Frey <rodf...@gmail.com>
Reply all
Reply to author
Forward
0 new messages