Percona XtraDB Cluster - HA scalable solution for MySQL

Python-based alternative for clustercheck does not work with HAProxy

Reported by Ovais Tariq on 2013-08-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraDB Cluster
Undecided
Unassigned

Bug Description

The Python based pyclustercheck script does not work with HAProxy, reason being that HAProxy sends an OPTIONS header first which BaseHTTPServer.HTTPServer does not understand most probably.

Following is the error that is reported:
web01.xxx - - [09/Aug/2013 04:00:59] code 501, message Unsupported method ('OPTIONS')
web01.xxx - - [09/Aug/2013 04:00:59] "OPTIONS / HTTP/1.0" 501 -
Traceback (most recent call last):
  File "/usr/lib64/python2.6/SocketServer.py", line 283, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib64/python2.6/SocketServer.py", line 309, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib64/python2.6/SocketServer.py", line 322, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib64/python2.6/SocketServer.py", line 617, in __init__
    self.handle()
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 329, in handle
    self.handle_one_request()
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 320, in handle_one_request
    self.send_error(501, "Unsupported method (%r)" % self.command)
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 357, in send_error
    self.send_response(code, message)
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 385, in send_response
    self.send_header('Date', self.date_time_string())
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 390, in send_header
    self.wfile.write("%s: %s\r\n" % (keyword, value))
  File "/usr/lib64/python2.6/socket.py", line 324, in write
    self.flush()
  File "/usr/lib64/python2.6/socket.py", line 303, in flush
    self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe

Seems HAProxy uses OPTIONS HTTP method to check on server health as a lightweight alternative.

The script only supports GET, so the workaround is to specify the method as GET, details here http://code.google.com/p/haproxy-docs/wiki/httpchk

Changed in percona-xtradb-cluster:
milestone: none → 5.5.33-23.7.6
status: New → Triaged
David Busby (d-busby) wrote :

Committed a fix here: https://github.com/Oneiroi/clustercheck/commit/45d56b5bc44388c9e86a4e58eabf725b7f8cbba4

Differs to the do_GET method; please let me know if this does not suffice.

Changed in percona-xtradb-cluster:
status: Triaged → Fix Committed

Verified with 'curl -X OPTIONS'.

Changed in percona-xtradb-cluster:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers