I have a strange behavior for my site load balanced with nginx.
I have 1 Loadbalancer with nginx and 3 servers with apache.
sometimes a request is doubled and send to 2 of my apache webservers.
this is a big problem for me, because this is sometimes a requests that
is doing a payement.
I checked this behavior with doing a log of all my payment transactions
and there a some transactions
for the same person double at the same second! (the user can’t do this
at the website, because I send the form which is doing the request with
JS and ask the User if he really wants to pay and so on)
Here are my config files for nginx, please help me:
On Fri, Jun 05, 2009 at 07:59:13AM -0400, funkdoobiest wrote:
Hi,
I have a strange behavior for my site load balanced with nginx.
I have 1 Loadbalancer with nginx and 3 servers with apache.
sometimes a request is doubled and send to 2 of my apache webservers.
this is a big problem for me, because this is sometimes a requests that is doing a payement.
I checked this behavior with doing a log of all my payment transactions and there a some transactions
for the same person double at the same second! (the user can’t do this at the website, because I send the form which is doing the request with JS and ask the User if he really wants to pay and so on)
It doesn’t looks like nginx problem. Try checking
logs (frontend
and backend ones) - probably your javascript code
just does
something wrong.
Maxim D.
I checked it about 100 times. I checked the logs also. It’s not my
script.
The requests are at the same second. If i disable the loadbalancer (in
this case nginx) double request are stopping.
On Mon, Jun 08, 2009 at 06:45:03AM -0400, funkdoobiest wrote:
is
send the form which is doing the request with
Maxim D.
Maxim D.
I checked it about 100 times. I checked the logs also. It’s not my script.
The requests are at the same second. If i disable the loadbalancer (in this case nginx) double request are stopping.
Try the following:
Post here nginx -V output to make it clear which version do you
use.
Post here results of your logs investigations to make it clear
that problem appears somewhere at nginx level.
This should include relevant nginx access logs (expected: one line
with client request; and some grep results to show there is no other
identical lines), relevant backend access logs (doubled request
should be visible here), relevant lines from nginx error_log if any.
Post here your nginx configs to make it clear how requests in
question are processed. There are more than one way to screw
things up, and nginx config does matter.
Error code 499 means that client closed connection before it got
response. In this particular case it looks like duplicate form
submit, e.g. due to second click on submit button.
Maxim D.
I got this 499 error code for about 10% of all the connections. not just
for form-submits.
It seems that “proxy_ignore_client_abort on;” fix that problem. But why?
Is it ok to ignore client aborts?
I got this 499 error code for about 10% of all the connections. not just for form-submits.
In general 499 errors are normal, since clients tend to close
browser windows/tabs, cancel downloads or just navigate to another
page e.g. before loading all images etc. High percentage of this
errors may indicate that your site is too slow, but since actual
numbers depend heavily on site usage pattern it’s hard to say what
is “high”.
It seems that “proxy_ignore_client_abort on;” fix that problem. But why? Is it ok to ignore client aborts?
Directive proxy_ignore_client_abort instructs nginx to finish
request processing even if client closed connection. It’s safe
but usually it’s just waste of resources (since backend response
will be thrown away).
I also had the same mistakes of double request
I try to do proxy_ignore_client_abort on,http_499 fewer errors, but
appeared http_400 error.
the double request at the some time problem still was not solved
sever info
nginx (gzip)–(static request)–>squid—>apache
|
|
(php request )
|
|
nginx(loadbalance+gzip)
|
apache
I have 1 Loadbalancer with nginx and 4 servers with apache.
apache 2.0.59
nginx version: nginx/0.7.65
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
configure arguments: --user=www --group=www --prefix=/usr/local/nginx/
–with-http_stub_status_module --with-http_realip_module
On Tue, Jun 30, 2009 at 10:54:57AM -0400, funkdoobiest wrote:
Hi,
the problem of the doubled requests is still there
Here are the lines from the logs:
nginx-access-log:
[…]
213.162.66.XXX - - [28/Jun/2009:14:11:20 +0200] “POST /premium/paypremium HTTP/1.1” 400 0 “http://www.DOMAIN.COM/premium/getpremium/” “Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)”
[…]
Here nginx returned 400 (Bad Request). Since number of bytes sent
to client logged as 0 it’s looks like connection has been dropped
by client while sending request. It shouldn’t involve any
upstream work after error was detected though.
There is no entry in the error-logs for this requests.
Some detailed info should be logged at info level. If your config
hasn’t changed from initial post - your logging level currently
set to error which isn’t enough to see such messages.
Could you please try to obtain debug log for such request?