basho/riak_api — pull request #54 by seancribbs (2014-01-27 21:25:03+00:00)
Title: HAproxy health-check causes node shutdown

HAproxy uses a naïve health-check mechanism that simply opens a TCP socket and then closes it immediately after it is accepted by the server. This causes the call to `peername/1` in `riak_api_pb_server` to return `{error, enotconn}` instead of the expected `{ok, Peername}`. The resulting badmatch propagates to the listener process (it was waiting on a reply via `gen_fsm:sync_send_event`), which then crashes the application supervisor after too many restarts.

Using this example config:

```
listen riak_pbc_demo_10 0.0.0.0:9109
balance leastconn
option tcplog
mode tcp
server 127.0.0.1 127.0.0.1:8087 check
```