NonWritableChannelException when iterating using graphDb.getAllNodes() on EmbeddedReadOnlyGraphDatabase

29 views
Skip to first unread message

David Allsopp

unread,
Jan 6, 2012, 9:23:18 AM1/6/12
to ne...@googlegroups.com
I am iterating over all the nodes in my database, to generate statistics:

graphDb = new EmbeddedReadOnlyGraphDatabase(DB_PATH);
for (Node node : graphDb.getAllNodes())
  {
   // Do something useful, e.g. call node.getRelationships() and count them.
   // The error occurs regardless of whether there's any graph access in this loop
  }
 
All seems well until I get near to the end (or perhaps actually at the end - I can't tell), when I get:

java.nio.channels.NonWritableChannelException
    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:638)
    at org.neo4j.kernel.impl.nioneo.store.AbstractPersistenceWindow.writeOut(AbstractPersistenceWindow.java:104)
    at org.neo4j.kernel.impl.nioneo.store.PersistenceWindowPool.freeWindows(PersistenceWindowPool.java:451)
    at org.neo4j.kernel.impl.nioneo.store.PersistenceWindowPool.expandBricks(PersistenceWindowPool.java:569)
    at org.neo4j.kernel.impl.nioneo.store.PersistenceWindowPool.acquire(PersistenceWindowPool.java:148)
    at org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.acquireWindow(CommonAbstractStore.java:558)
    at org.neo4j.kernel.impl.nioneo.store.NodeStore.loadLightNode(NodeStore.java:177)
    at org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.nodeLoadLight(ReadTransaction.java:85)
    at org.neo4j.kernel.impl.persistence.PersistenceManager.loadLightNode(PersistenceManager.java:82)
    at org.neo4j.kernel.impl.core.NodeManager.getNodeByIdOrNull(NodeManager.java:421)
    at org.neo4j.kernel.impl.core.NodeManager.access$000(NodeManager.java:67)
    at org.neo4j.kernel.impl.core.NodeManager$1.fetchNextOrNull(NodeManager.java:459)
    at org.neo4j.kernel.impl.core.NodeManager$1.fetchNextOrNull(NodeManager.java:449)
    at org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55)
    at test.AllNodes.<init>(AllNodes.java:63)
    at test.AllNodes.main(AllNodes.java:147)

I have an estimated 11 million nodes, and the error consistently occurs after 10948345 nodes have been processed.

I am using version 1.6.M01 on 32-bit Windows.

Mattias Persson

unread,
Jan 9, 2012, 8:49:11 AM1/9/12
to ne...@googlegroups.com
I think you've discovered a bug here, I'm pretty sure it will be fixed in the next milestone. As a workaround you can go for EmbeddedGraphDatabase instead.

2012/1/6 David Allsopp <dnal...@gmail.com>



--
Mattias Persson, [mat...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
Reply all
Reply to author
Forward
0 new messages