#2967·Redis

Badly formatted result when using pubsub in a transaction

Author: daurnimatorCreated Dec 21, 2015Updated Sep 16, 2026
Labelsnon critical bugpubsubclass:bug

Generated with:

local r = require "lredis.cqueues".connect_tcp()
r:call("multi")
r:call("subscribe", "test")
r:call("publish", "test", "a message")
r:call("unsubscribe", "test")
r:call("exec")

What goes over the socket:

connect(127.0.0.1/[127.0.0.1]:6379): ready
write(127.0.0.1/[127.0.0.1]:6379): sent 15 bytes
  000000  2a 31 0d 0a 24 35 0d 0a  6d 75 6c 74 69 0d 0a     |*1..$5..multi.. |
read(127.0.0.1/[127.0.0.1]:6379): rcvd 5 bytes
  000000  2b 4f 4b 0d 0a                                    |+OK..           |
write(127.0.0.1/[127.0.0.1]:6379): sent 29 bytes
  000000  2a 32 0d 0a 24 39 0d 0a  73 75 62 73 63 72 69 62  |*2..$9..subscrib|
  000010  65 0d 0a 24 34 0d 0a 74  65 73 74 0d 0a           |e..$4..test..   |
read(127.0.0.1/[127.0.0.1]:6379): rcvd 9 bytes
  000000  2b 51 55 45 55 45 44 0d  0a                       |+QUEUED..       |
write(127.0.0.1/[127.0.0.1]:6379): sent 42 bytes
  000000  2a 33 0d 0a 24 37 0d 0a  70 75 62 6c 69 73 68 0d  |*3..$7..publish.|
  000010  0a 24 34 0d 0a 74 65 73  74 0d 0a 24 39 0d 0a 61  |.$4..test..$9..a|
  000020  20 6d 65 73 73 61 67 65  0d 0a                    |.message..      |
read(127.0.0.1/[127.0.0.1]:6379): rcvd 9 bytes
  000000  2b 51 55 45 55 45 44 0d  0a                       |+QUEUED..       |
write(127.0.0.1/[127.0.0.1]:6379): sent 32 bytes
  000000  2a 32 0d 0a 24 31 31 0d  0a 75 6e 73 75 62 73 63  |*2..$11..unsubsc|
  000010  72 69 62 65 0d 0a 24 34  0d 0a 74 65 73 74 0d 0a  |ribe..$4..test..|
read(127.0.0.1/[127.0.0.1]:6379): rcvd 9 bytes
  000000  2b 51 55 45 55 45 44 0d  0a                       |+QUEUED..       |
write(127.0.0.1/[127.0.0.1]:6379): sent 14 bytes
  000000  2a 31 0d 0a 24 34 0d 0a  65 78 65 63 0d 0a        |*1..$4..exec..  |
read(127.0.0.1/[127.0.0.1]:6379): rcvd 119 bytes
  000000  2a 33 0d 0a 2a 33 0d 0a  24 39 0d 0a 73 75 62 73  |*3..*3..$9..subs|
  000010  63 72 69 62 65 0d 0a 24  34 0d 0a 74 65 73 74 0d  |cribe..$4..test.|
  000020  0a 3a 31 0d 0a 2a 33 0d  0a 24 37 0d 0a 6d 65 73  |.:1..*3..$7..mes|
  000030  73 61 67 65 0d 0a 24 34  0d 0a 74 65 73 74 0d 0a  |sage..$4..test..|
  000040  24 39 0d 0a 61 20 6d 65  73 73 61 67 65 0d 0a 3a  |$9..a.message..:|
  000050  31 0d 0a 2a 33 0d 0a 24  31 31 0d 0a 75 6e 73 75  |1..*3..$11..unsu|
  000060  62 73 63 72 69 62 65 0d  0a 24 34 0d 0a 74 65 73  |bscribe..$4..tes|
  000070  74 0d 0a 3a 30 0d 0a                              |t..:0..         |

You'll notice that the exec response returned is 3 elements long:

  • first element is {"subscribe", "test", 1}
  • second element is {"message", "test", "a message"}
  • third element is 1 (probably the result from the publish?)

After that the server sends a 3 element array with only one element: {"unsubscribe", "test", 0}