Closed darix closed 8 years ago
ok this only happens when haproxy is connecting but not e.g. curl.
aaaaaand there we go:
sendto(4, "HTTP/1.0 200 OK\r\n", 17, 0, NULL, 0) = 17
sendto(4, "Server: BaseHTTP/0.3 Python/2.7.10\r\n", 36, 0, NULL, 0) = -1 ECONNRESET (Connection reset by peer)
sendto(4, "Server: BaseHTTP/0.3 Python/2.7.10\r\n", 36, 0, NULL, 0) = -1 EPIPE (Broken pipe)
so i tried to move the whole request sending part into a function (reduces code duplication a bit too)
but i cant catch the IOError with it.
def send_full_response(self, status_code, headers = { "Content-type": "text/html" }, body="Someone forgot a check response body"):
try:
self.send_response(status_code)
for header, value in headers.items():
self.send_header(header, value)
self.end_headers()
self.wfile.write(body)
except IOError as e:
# haproxy only reads the header ignore write errors here
pass
....
self.send_full_response(status_code=503, body="Percona XtraDB Cluster Node state could not be retrieved.")
neither did it help to wrap
try:
httpd.serve_forever()
except IOError as e:
# haproxy only reads the header ignore write errors here
#if e.errno == errno.EPIPE:
pass
any ideas?
@darix please take a look at the twisted implementation of the clustercheck on the branch here: https://github.com/Oneiroi/clustercheck/tree/twisted and the associated write up here, https://www.percona.com/blog/2014/05/16/benchmark-simplehttpserver-vs-pyclustercheck-twisted-implementation/ we've found the twisted implementation to not suffer from issues such as these previously, the only reason it's not merged into the master version atm is legacy support (twisted is not available on some older systems).
JFYI: i also have a POC of a ruby implementation done now :D
Closing issue
any idea what could cause that?