Case for an automatic GOAWAY error

21 views
Skip to first unread message

Josh Yudaken

unread,
Aug 23, 2016, 7:51:35 PM8/23/16
to Redis DB
Hi,

We've been developing various servers using Redis protocol and have been using a minor protocol extension that might be useful for core redis as well.

Essentially at the beginning of a graceful shutdown before each connection is closed we write "-GOAWAY\r\n" as a final message (essentially a GOAWAY error to a request that was never sent.) On receipt of this error message our clients automatically reconnect and resend any commands from the request that received the GOAWAY error onwards. This is safe since we know that the server did not process any of those requests.

Unfortunately this is a break in protocol but is safe to be implemented in clients first, and left as a default off option in the redis server.

You can see our implementation of the required client change in our fork of node_redis at: https://github.com/smyte-forks/node_redis/commit/cd535d79e2a907598790f93516a6f0749769f0e3

This has very similar intentions and implementation to the HTTP2 GOAWAY frame: https://http2.github.io/http2-spec/#GOAWAY

In the current version of the client the responses are a little confusing, but could easily be improved if `redis-cli` had built-in support for the message:
127.0.0.1:8888> GET x
(nil)
127.0.0.1:8888> SHUTDOWN
OK
127.0.0.1:8888> GET X
(error) GOAWAY
127.0.0.1:8888> GET X
not connected> GET X
(nil)
127.0.0.1:8888>

Thanks,
Josh
Reply all
Reply to author
Forward
0 new messages