fastcgi bug when doing something a little tricky

Dave Cheney dave at cheney.net
Sat Jul 5 11:59:10 MSD 2008


Check the value of

proxy_read_timeout

We've had sporadic issues with double posts to comments and other  
'should not happen' issues even though we've debounced all the buttons  
for a while now. Until now I've put it down to PEBKAC but thinking  
about your issue I wonder if its actually a problem with my config.  
What could be happening is your request is being queued on more than  
one upstream. Even though nginx discards the responses from backends  
that is has timed out, that does not roll back the effects of those  
upstreams that have already processed the request, and being a POST  
request it is likely that it will be some kind of database modification.

I had a quick hack at constructing a config which will attempt GETS  
multiple times and POSTS only once.

location /controller/update {
	if ($request_method == 'POST') {
		break;
		proxy_pass http://mongrel_post;
	}
	proxy_pass http://mongrel_get;
}

upstream mongrel_get {
	localhost:8080 fail_timeout=0;
	localhost:8081 fail_timeout=0;
}

upstream mongrel_post {
	localhost:8080 max_fails=1 fail_timeout=0;
	localhost:8081 max_fails=1 fail_timeout=0;
}

Igor, could you see a need for a proxy configuration variable that  
treats Non-idempotent specially.

Cheers

Dave

On 05/07/2008, at 4:29 PM, Kingsley Foreman wrote:

> Hi folks,
>
> Ive just found a bug/feature when using fastcgi in a slightly  
> unusual manner.
>
> nginx version: nginx/0.6.31
>
> http://websiteurl/article.php
>
> works fine
>
> however if you do
>
> http://websiteurl/article.php/blah/blah
>
> It will still run article.php like i want it to do however depending  
> on the length of html the script it runs it multiple times
>
> eg. if I add
> exec("/bin/echo 1 >> /data/www/test");
> to the top of article.php and go to
>
> http://websiteurl/article.php
>
> it returns
> ___________________
> 1
> ___________________
>
> however if i go to
> http://websiteurl/article.php/1/
>
> it returns
> __________________
> 1
> 1
> 1
> 1
> 1
> 1
> 1
> 1
> 1
> 1
> ___________________
>
> Its a bit of a problem for what im trying to do as i would ideally  
> like to have
> http://websiteurl/article/id/name/etc
> and have it process article as a php script
>
> Kingsley Foreman
> Technical Leader Content Services / Content Management Group
>
> =============================================
> Internode Systems Pty Ltd
>
> PO Box 284, Rundle Mall 5000
> Level 5 150 Grenfell Street, Adelaide 5000
> Phone:  +61 8 8228 2978
> Fax:    +61 8 8235 6978
> Web:    http://www.internode.on.net
>      http://games.internode.on.net
> =============================================
>
>






More information about the nginx mailing list