node-neo4j icon indicating copy to clipboard operation
node-neo4j copied to clipboard

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

Open gpierrick opened this issue 10 years ago • 3 comments

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 avatar Jan 20 '16 16:01 gpierrick

Hi @aseemk any updates on the issue? Thanks!

gpierrick avatar Jan 27 '16 21:01 gpierrick

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!

aseemk avatar Jan 28 '16 16:01 aseemk

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

Will update soon.

gpierrick avatar Jan 28 '16 16:01 gpierrick