antirez 1eab62f7e5 Remove the client from CLOSE_ASAP list before caching the master.
This was broken in 1a7cd2c: we identified a crash in the CI, what
was happening before the fix should be like that:

1. The client gets in the async free list.
2. However freeClient() gets called again against the same client
   which is a master.
3. The client arrived in freeClient() with the CLOSE_ASAP flag set.
4. The master gets cached, but NOT removed from the CLOSE_ASAP linked
   list.
5. The master client that was cached was immediately removed since it
   was still in the list.
6. Redis accessed a freed cached master.

This is how the crash looked like:

=== REDIS BUG REPORT START: Cut & paste starting from here ===
1092:S 16 May 2020 11:44:09.731 # Redis 999.999.999 crashed by signal: 11
1092:S 16 May 2020 11:44:09.731 # Crashed running the instruction at: 0x447e18
1092:S 16 May 2020 11:44:09.731 # Accessing address: 0xffffffffffffffff
1092:S 16 May 2020 11:44:09.731 # Failed assertion:  (:0)

------ STACK TRACE ------
EIP:
src/redis-server 127.0.0.1:21300(readQueryFromClient+0x48)[0x447e18]

And the 0xffff address access likely comes from accessing an SDS that is
set to NULL (we go -1 offset to read the header).
2020-05-16 18:04:17 +02:00
..
2020-05-08 10:37:35 +02:00
2020-05-08 10:37:35 +02:00
2019-11-20 20:39:04 -05:00
2019-07-17 16:40:24 +03:00
2020-05-08 10:37:35 +02:00
2020-05-15 22:23:24 +02:00
2020-05-08 10:37:35 +02:00
2020-04-28 11:20:15 +02:00
2020-04-28 11:20:15 +02:00
2020-04-28 11:20:15 +02:00
2020-05-08 10:37:36 +02:00
2018-07-03 18:19:46 +02:00
2019-02-24 21:38:15 +01:00
2020-04-30 13:43:58 +02:00
2020-03-25 15:54:34 +01:00
2019-10-24 14:24:55 +03:00
2020-05-08 10:37:36 +02:00
2020-05-15 22:23:24 +02:00
2019-11-19 17:23:47 +08:00
2020-04-07 16:52:04 +02:00
2020-05-14 11:29:43 +02:00
2020-05-08 10:37:35 +02:00
2020-04-15 16:03:16 +02:00
2018-07-03 18:19:46 +02:00
2019-10-02 11:30:20 +02:00
2020-04-07 16:53:13 +02:00
2020-04-16 16:09:06 +02:00
2020-03-05 12:51:15 +01:00
2020-05-15 22:23:24 +02:00
2018-11-11 18:49:55 +00:00
2020-04-24 16:49:27 +02:00
2020-05-15 22:29:52 +02:00
2020-05-08 10:37:35 +02:00