Python-based alternative for clustercheck does not work with HAProxy

Bug #1210239 reported by Ovais Tariq
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Fix Released
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

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

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
Revision history for this message
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
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

Verified with 'curl -X OPTIONS'.

Changed in percona-xtradb-cluster:
status: Fix Committed → Fix Released
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1414

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.