question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transaction exec sometimes returns null response

See original GitHub issue

Expected behavior

When running the following code:

            jedis.watch(key);
            Transaction t = jedis.multi();
            t.incr(key);
            List<Object> response = t.exec();
            jedis.unwatch();
            if (response != null && response.size() == 1) {
                jedis.expire(key, expiry);
                return (Long)response.get(0);
            } else {
                LOGGER.error(String.format("Unexpected response size. The response was %s for key %s and expiry %d",
                response, key, expiry));

                return null;
            }

That logger statement should never occur, because if there was no exception until that point then there should always be exactly one item in the list of responses.

Actual behavior

On rare occasion, the response object is null.

This logging statement is available: “Unexpected response size. The response was null for key my_key and expiry 31536000”

Steps to reproduce:

Unknown. Cannot reproduce consistency.

Redis / Jedis Configuration

Jedis version: 2.8.0

Redis version: 6.2.4

Java version: 1.8

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
sazzad16commented, Oct 5, 2021

@spmason In short, could be.

0reactions
spmasoncommented, Oct 4, 2021

Thanks. It’s good to have confirmation.

So then this issue could be explained by an overlapping transaction on the watched key?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis MULTI transaction randomly returning null on EXEC ...
Redis MULTI transaction randomly returning null on EXEC callback in NodeJS · 1. Sounds like you have a race condition somewhere. Are you...
Read more >
Impossible to log errors after dooming a transaction within an ...
There is a way to first write a 'custom' log entry by using raiserror with LOG. It is going to raise the error...
Read more >
Transactions | Redis
If EXEC fails (i.e. returns a Null reply) we just repeat the operation. Redis scripting and transactions. Something else to consider for transaction...
Read more >
Lettuce Reference Guide
The response related to the execution of the command is received at the moment the EXEC command is processed, and the transaction is...
Read more >
Serverless SQL pool self-help - Azure Synapse Analytics
Execute any query, for example, SELECT 1 , on serverless SQL pool ... Incorrect network configuration is often the cause of this behavior....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found