openresty / openresty/lua-resty-redis

corrupted result from redis:get

Open
#87 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
2k
Forks
447
Avg merge
2h 24m
Merged PRs (30d)
3

Description

my code looks something like

  local redis = redis_connection:get_redis()
  local result_json = redis:get(self.params.uuid)
  local result = cjson.decode(result_json)
  ...

intermittently, the redis:get call will return a string in which the beginning is replaced by a substring that appears later in the string. that is, if the correct result is:
one two three four five six seven eight nine ten
the corrupted result might look like:
six seven eight nineive six seven eight nine ten
the resulting string is the same length as the correct string.

the actual result is much longer than this conceptual example. in the instance I have been able to concretely debug, the size of the result is 10078 bytes. the first 4076 bytes have been replaced by a duplicate of bytes 4084 to 8159 of the correct result. bytes 4076 to the end (10077) are correct.

I am not certain how generally this description holds. I will try to gather more data from corrupted calls. the intermittent nature of this complicates things slightly.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Lua snippet using redis_connection:get_redis() and redis:get() and capture corrupted results, especially the reported 10078-byte case. Compare the returned bytes with the expected Redis value to determine whether the corruption is reproducible; done requires identifying and fixing the cause of the altered result and verifying that complete values are returned.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, redis
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.