nginx_upstream_check_module icon indicating copy to clipboard operation
nginx_upstream_check_module copied to clipboard

Healthcheck is closing the connection abrutbly after reading status line

Open JonathanHuot opened this issue 7 years ago • 0 comments

Current behavior: upstream_check_module send healthcheck and kills the connection to the server once the module has read the HTTP status line (HTTP/1.1 200). However it leads to abnormal errors on server-side, because the server is still sending bytes into the HTTP connection while the connection get closed. It happens mostly when check responses contain a lot of HTTP headers, or has a huge body.

Proposed changes: The attached PR, in addition to read the status line, reads also the HTTP header (every bytes until \r\n\r\n) before closing the connection. The immediate impact is that server-side does not longer raises errors, except for huge body; but we assume that checks are setup to return small payloads.

Step to reproduce issue:

configure nginx upstream to :8080 and send http checks to /ping every 3secs
run bottle as a server (as python code below)
wait few checks attempts until bottle display python exceptions

from bottle import route, run, template

@route('/ping') def index(): return "" run(host='localhost', port=8080)

Fixed in https://github.com/yaoweibin/nginx_upstream_check_module/pull/170

JonathanHuot avatar Apr 03 '18 08:04 JonathanHuot