Re: Erroneous error code on wrong configuration.

2016-05-01 Thread Lukas Tribus

Hi,


Am 01.05.2016 um 18:18 schrieb Jonathan Matthews:

> frontend my_frontend

> bind :80
> acl global hdr(host) -i blablabla
> use_backend my_backend if global
> backend my_backend
> server google www.google.com:80 

Given that you don't alter the Host header before submitting the 
request to Google, I'm not sure what you're expecting to happen.




This has been previously troubleshooted on discourse and I advised to 
post this to the mailing list.


This is not about when the Host header is actually blablabla. Its about 
when its not:


The ACL doesn't match, and no backend is selected, no server can be 
connected to. That's why we see NOSRV in the log. However, we also see 
the SC flag, which implies that there was a network problem while 
connecting to a backend server. Which is not true in this case, because 
we never even opened a socket to the backend.





Why do you think it's misleading?


We don't open a backend socket, so we shouldn't imply (by the SC flag) 
that there is a network problem on the backend.


Here's how this looks trough strace (you can see the only involved 
sockets are the one on the frontend and the syslog socket):


18:32:55.530183 epoll_wait(3, {{EPOLLIN, {u32=4, u64=4}}}, 200, 1000) = 1
18:32:55.874843 gettimeofday({1462120375, 874872}, NULL) = 0
18:32:55.874934 accept4(4, {sa_family=AF_INET, sin_port=htons(34934), 
sin_addr=inet_addr("10.0.0.55")}, [16], SOCK_NONBLOCK) = 6

18:32:55.875060 setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = 0
18:32:55.875222 accept4(4, 0xbf81501c, [128], SOCK_NONBLOCK) = -1 EAGAIN 
(Resource temporarily unavailable)
18:32:55.875356 recv(6, 0x926e318, 15360, 0) = -1 EAGAIN (Resource 
temporarily unavailable)
18:32:55.875392 epoll_ctl(3, EPOLL_CTL_ADD, 6, {EPOLLIN|EPOLLRDHUP, 
{u32=6, u64=6}}) = 0

18:32:55.875392 gettimeofday({1462120375, 875392}, NULL) = 0
18:32:55.875392 epoll_wait(3, {{EPOLLIN, {u32=6, u64=6}}}, 200, 1000) = 1
18:32:55.875898 gettimeofday({1462120375, 875920}, NULL) = 0
18:32:55.875972 recv(6, "GET / HTTP/1.1\r\nUser-Agent: curl"..., 15360, 
0) = 73

18:32:55.876758 epoll_ctl(3, EPOLL_CTL_DEL, 6, {0, {u32=6, u64=6}}) = 0
18:32:55.877220 gettimeofday({1462120375, 877361}, NULL) = 0
18:32:55.877643 epoll_wait(3, {}, 200, 0) = 0
18:32:55.878121 gettimeofday({1462120375, 878261}, NULL) = 0
18:32:55.878507 send(6, "HTTP/1.0 503 Service Unavailable"..., 212, 
MSG_DONTWAIT|MSG_NOSIGNAL|MSG_MORE) = 212

18:32:55.879024 shutdown(6, SHUT_WR)= 0
18:32:55.879460 close(6)= 0
18:32:55.879868 sendmsg(5, {msg_name(16)={sa_family=AF_INET, 
sin_port=htons(514), sin_addr=inet_addr("10.0.0.3")}, 
msg_iov(8)=[{"<46>May  1 18:32:55 ", 20}, {"haproxy", 7}, {"[", 1}, 
{"9363", 4}, {"]: ", 3}, {"", 0}, {"10.0.0.55:34934 
[01/May/2016:18:"..., 136}, {"\n", 1}], msg_controllen=0, msg_flags=0}, 
MSG_DONTWAIT|MSG_NOSIGNAL) = 172





Regards,

Lukas




Re: Erroneous error code on wrong configuration.

2016-05-01 Thread Jonathan Matthews
On 29 Apr 2016 11:29, "Mayank Jha"  wrote:
>
> I am facing the following in haproxy 1.5. I get the following error, with
error code "SC" which is very misleading, for the below mentioned config.

Why do you think it's misleading?

> haproxy[6379]: 127.0.0.1:53010 [29/Apr/2016:12:05:40.552] my_frontend
my_frontend/ -1/-1/-1/-1/1 503 212 - - SC-- 0/0/0/0/0 0/0 "GET /
HTTP/1.1"
>
> With the following config.
>
> frontend my_frontend
> bind :80
> acl global hdr(host) -i blablabla
> use_backend my_backend if global
> backend my_backend
> server google www.google.com:80

Given that you don't alter the Host header before submitting the request to
Google, I'm not sure what you're expecting to happen.

I think there's a fair bit of extra information you'll need to provide
before I (at least; not speaking for anyone else!) understand what your
problem actually *is*. You're assuming we know more than we do about your
setup, aims, and expected outcomes :-)

J


Erroneous error code on wrong configuration.

2016-04-29 Thread Mayank Jha
I am facing the following in haproxy 1.5. I get the following error, with
error code "SC" which is very misleading, for the below mentioned config.

haproxy[6379]: 127.0.0.1:53010 [29/Apr/2016:12:05:40.552] my_frontend
my_frontend/ -1/-1/-1/-1/1 503 212 - - SC-- 0/0/0/0/0 0/0 "GET /
HTTP/1.1"

With the following config.

frontend my_frontend
bind :80
acl global hdr(host) -i blablabla
use_backend my_backend if global
backend my_backend
server google www.google.com:80

Would love to work on the fix for the same, since this killed a lot of my
time debugging due to the confusing error flags "SC".
-- 
Mayank Jha
http://mjnovice.wordpress.com/