-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when requesting via xinetd+curl, "Recv failure" #2
Comments
Adding Content-Length: 0 is not really a solution, since a client will ignore the content. I modified the script in such a way that it reports the content length correctly (and as such, curl exits gracefully). |
I'm experiencing the same issue myself and my /usr/bin/clustercheck contains echo -en "Content-Length: 40\r\n" Depending on if its a success or failure. In my instance setting echo -en "Content-Length: 0\r\n" did not help. See more details here: http://serverfault.com/questions/504756/curl-failure-when-receiving-data-from-peer-using-percona-xtradb-cluster-check I should clarify when I say "the same issue" - I get the same error when I use CURL to hit clustercheck. Oddly it only happens when I hit cluster check remotely - hitting it locally seems to work. In my case I'm using hardware load balancers not AWS load balancers. |
Here is a packet capture containing some successes and some failures: https://www.dropbox.com/s/u2b9asn1p5vyh0r/data.pcap In the case where there is a success there is an HTTP payload but when it fails there isn't an http payload. |
I have exactly the same issue |
I have exactly the same issue. |
If it helps anyone, here's the solution we ended up using (its not pretty but its been working for us for about a year): #!/bin/bash # # Script to make a proxy (ie HAProxy) capable of monitoring Percona XtraDB Cluster nodes properly # # Author: Olaf van Zandwijk # Documentation and download: https://github.com/olafz/percona-clustercheck # # Based on the original script from Unai Rodriguez # Modified by Brad Baker 5/7/2013 # # This cluster check script is provided by the percona packages under # /usr/bin/clustercheck. I've made a copy of it to /our-custom-location because I had # to customize it to get it to work reliably and I don't want YUM overwriting # our customized version. # # For some reason the percona provided version of this script will # intermittently fail when accessed remotely using curl or our load balancer # health check. To test this for yourself remotely run the following command # for i in {1..1000}; do curl http://your-server:9200; sleep 2; date; done # # After extensive debugging one of the Percona devs had me add sleep statements. # After doing so the intermittent issue stopped - WHY?! I have no idea. # But with those in place it works reliably. if [[ $1 == '-h' || $1 == '--help' ]];then echo "Usage: $0 " exit fi MYSQL_USERNAME="${1:-clustercheckuser}" MYSQL_PASSWORD="${2:-clustercheckpassword!}" AVAILABLE_WHEN_DONOR=${3:-0} ERR_FILE="${4:-/dev/null}" #Timeout exists for instances where mysqld may be hung TIMEOUT=10 # # Perform the query to check the wsrep_local_state # WSREP_STATUS=`mysql -nNE --connect-timeout=$TIMEOUT --user=${MYSQL_USERNAME} --password=${MYSQL_PASSWORD} \ -e "SHOW STATUS LIKE 'wsrep_local_state';" 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}` if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]] then # Percona XtraDB Cluster node local state is 'Synced' => return HTTP 200 # Shell return-code is 0 echo -en "HTTP/1.1 200 OK\r\n" sleep 0.1 echo -en "Content-Type: text/plain\r\n" sleep 0.1 echo -en "Connection: close\r\n" sleep 0.1 echo -en "Content-Length: 40\r\n" sleep 0.1 echo -en "\r\n" sleep 0.1 echo -en "Percona XtraDB Cluster Node is synced.\r\n" sleep 0.1 exit 0 else # Percona XtraDB Cluster node local state is not 'Synced' => return HTTP 503 # Shell return-code is 1 echo -en "HTTP/1.1 503 Service Unavailable\r\n" sleep 0.1 echo -en "Content-Type: text/plain\r\n" sleep 0.1 echo -en "Connection: close\r\n" sleep 0.1 echo -en "Content-Length: 44\r\n" sleep 0.1 echo -en "\r\n" sleep 0.1 echo -en "Percona XtraDB Cluster Node is not synced.\r\n" exit 1 fi |
Hello my dear friends.
So why sleeps did not help for every client?
Anyway, the solution is very easy - eather you properly read http headers from stdin, wait for I hope it helps to people like I, who experienced the same problem. |
Got to this ticket from google. Here is one more solution. We are looking for \r in input and only after it returning responce.
|
just use #18 |
This breaks Amazon ELB, as it sees a 200 response of this nature as a failure.
I tweaked the script to add a
Content-Length: 0
header, which appears to make Amazon happy, but I'm not entirely clear on the implications of this, or if there's a better way.The text was updated successfully, but these errors were encountered: