Skip to content

Conversation

@enjoy-binbin
Copy link
Contributor

This was introduced in #13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in Unblock by timer test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:

beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);

This was introduced in redis#13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut

bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```
@enjoy-binbin enjoy-binbin requested a review from oranagra January 30, 2024 11:52
@enjoy-binbin
Copy link
Contributor Author

@oranagra the invalidFunctionWasCalled is a other issue (i can reproduce it in local), let's fix it in another PR?

and btw, in the process of trying to reproduce it, I seem to have discovered another problem:

60254:M 30 Jan 2024 19:34:01.289 # === ASSERTION FAILED ===
60254:M 30 Jan 2024 19:34:01.289 # ==> networking.c:2089 'c->duration == 0' is not true

------ STACK TRACE ------

Backtrace:
0   redis-server                        0x000000010c0f15de resetClient + 238
1   redis-server                        0x000000010c19629a unblockClient + 394
2   redis-server                        0x000000010c196fbe unblockClientOnTimeout + 78
3   redis-server                        0x000000010c1f1356 checkBlockedClientTimeout + 86
4   redis-server                        0x000000010c1f182f handleBlockedClientsTimeout + 239
5   redis-server                        0x000000010c1970e9 blockedBeforeSleep + 9
6   redis-server                        0x000000010c0c4447 beforeSleep + 279
7   redis-server                        0x000000010c0b5b4f aeProcessEvents + 159
8   redis-server                        0x000000010c0b64af aeMain + 63
9   redis-server                        0x000000010c0d4e02 main + 4066
10  dyld                                0x00007ff817c9c41f start + 1903

I'm going to try to fix them in another clean PR when I figured it out..

Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this one is gonna be backported together with the other one.
so you can fix the other problems in another PR.

@oranagra oranagra merged commit 45a35a7 into redis:unstable Jan 30, 2024
@enjoy-binbin enjoy-binbin deleted the fix_block_timeout branch January 30, 2024 12:33
roggervalf pushed a commit to roggervalf/redis that referenced this pull request Feb 11, 2024
This was introduced in redis#13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```
YaacovHazan pushed a commit to YaacovHazan/redis that referenced this pull request May 16, 2024
This was introduced in redis#13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```

(cherry picked from commit 45a35a7)
YaacovHazan pushed a commit that referenced this pull request May 19, 2024
This was introduced in #13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```

(cherry picked from commit 45a35a7)
funny-dog pushed a commit to funny-dog/redis that referenced this pull request Sep 17, 2025
This was introduced in redis#13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants