[Neo4j] InvalidRecordException exception

rick.bullotta at burningskysoftware.com rick.bullotta at burningskysoftware.com
Fri Dec 17 17:53:05 CET 2010


   Hi, Johan.

   Is this related to the patch you provided me for a similar issue?  I
   had thought it made it into the milestone release(s).

   Thanks,

   Rick

   -------- Original Message --------
   Subject: Re: [Neo4j] InvalidRecordException exception
   From: Johan Svensson <[1]johan at neotechnology.com>
   Date: Wed, December 15, 2010 8:32 am
   To: Neo4j user discussions <[2]user at lists.neo4j.org>
   This will still happen in the 1.2.M05 release. I just wanted to make
   sure I linked the stacktrace's line numbers to the right part of the
   code since that exception being thrown at a different place in the
   delete method could mean there are other problems.
   -Johan
   On Wed, Dec 15, 2010 at 1:42 PM, George Ciubotaru
   <[3]george.ciubotaru at weedle.com> wrote:
   > Yes, the version I'm currently using is 1.1. Shall I understand that
   this kind of issue shouldn't occur in 1.2.M05?
   >
   > For the moment I'll take the pessimistic approach by guarding against
   (as in the example you gave) to assure that this is the reason and then
   I'll just accept the exception.
   >
   > Thank you for your quick and detailed response.
   >
   > Best regards,
   > George
   >
   >
   > -----Original Message-----
   > From: [4]user-bounces at lists.neo4j.org
   [[5]mailto:user-bounces at lists.neo4j.org] On Behalf Of Johan Svensson
   > Sent: 15 December 2010 12:23
   > To: Neo4j user discussions
   > Subject: Re: [Neo4j] InvalidRecordException exception
   >
   > Sorry, should also have asked what Neo4j version you use but guessing
   it is 1.1 or early milestone release?
   >
   > If so I think the problem is caused by two or more concurrent
   transactions running delete on the same relationship. If two
   transactions get a reference to the same relationship and concurrently
   delete that relationship it is possible for a InvalidRecordException to
   be thrown instead of a NotFoundException since the write lock is
   grabbed after the relationship has been verified to exist.
   >
   > Solution is either to accept the exception or to guard against it by
   first acquiring a read lock on the relationship before invoking
   relationship.delete(). Code example how to do this:
   >
   >    GraphDatabaseService gdb; // the graph db
   >    Relationship relationship; // the relationship to delete
   >
   >    LockManager lockManager = ((EmbeddedGraphDatabase)
   gdb).getConfig().getLockManager();
   >    lockManager.getReadLock( relationship );
   >    try
   >    {
   >        relationship.delete();
   >    }
   >    finally
   >    {
   >        lockManager.releaseReadLock( relationship );
   >    }
   >
   > Regards,
   > Johan
   >
   _______________________________________________
   Neo4j mailing list
   [6]User at lists.neo4j.org
   [7]https://lists.neo4j.org/mailman/listinfo/user

References

   1. mailto:johan at neotechnology.com
   2. mailto:user at lists.neo4j.org
   3. mailto:george.ciubotaru at weedle.com
   4. mailto:user-bounces at lists.neo4j.org
   5. mailto:user-bounces at lists.neo4j.org
   6. mailto:User at lists.neo4j.org
   7. https://lists.neo4j.org/mailman/listinfo/user


More information about the User mailing list