thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
925 stars 135 forks source link

Simple Transaction fail - The Transaction has expired - Neo4j 2.3.1 Ent #189

Open gpierrick opened 8 years ago

gpierrick commented 8 years ago

The following code fail and return an error from Neo4j

var tx = neo4j.db.beginTransaction();
    var query = [
        'MATCH (session:Session{id:{id}})',
        'SET session = {props}',
    ].join('\n');
    var paymentQuery = [
        'MATCH (payment:Payment {id: {id}})',
        'SET payment = {props}',
        'RETURN payment'
    ].join('\n');

    tx.cypher({
        query: query,
        params: {
            id: data.session.id,
            props: data.session
        },
    }, function (err) {
        if (err) {
            logger.error(err);
            return cb(err);
        }
        tx.cypher({
            query: paymentQuery,
            params: {
                id: data.payment.id,
                props: data.payment
            },
            commit: true
        }, function (err) {
            if (err) {
                logger.error(err);
                return cb(err);
            }
            return cb(null, true);
        });
    });

Error: See screenshot error

Running Neo4j 2.3.1 Enterprise

gpierrick commented 8 years ago

Hi @aseemk any updates on the issue? Thanks!

aseemk commented 8 years ago

Sorry for the delay!

Very strange. The tests here exercise transactions pretty thoroughly, and we also use them a bunch with no issues in production.

I wonder if this is a break with Neo4j 2.3.1 or similar. You mentioned you'll try Neo4j 2.2, thanks!

One thing that'll help debug this: are you getting this error upon making the first query? Or the second?

Presumably it's happening on the second query. If so, just before you make the query, can you console.log(tx._expires, 'vs.', Date.now());?

Thanks!

gpierrick commented 8 years ago

Yeah issue happen in the second query with commit: true. Sure will print the tx._expires

Will update soon.