Failed to redirect the HTTP response to the HTTP client: it seems that the user clicked the Stop button in his browser

The problem I am facing:

I send the request from the browser via ajax and send the request for processing as soon as the ajax call is called. I am showing a progress bar popup. The popup window stays on the page somewhere between 2-4 minutes and closes abruptly. When I see the request through the chrome network tab, I see that the request has stalled for the same duration for which the popup window is displayed. I see that the logic runs in the background as expected, but the pop-up did not wait for an answer and closed before it should have.

I set the log level to 7 and I see the information below

if there are 50 records that need to be processed, I see this information before each of these 50 records starts processing (I see the next line 50 times)

[pid = 29768 thr = 70024879087720 file = abstract_request_handler.rb: 472 time = 2016-08-30 08: 06: 43.250]: receiving a new request to the main socket

and finally i see it

[pid = 29571 thr = 139782938920704 file = ext / nginx / HelperAgent.cpp: 923 time = 2016-08-30 08: 10: 32.682]: Failed to redirect the HTTP response back to the HTTP client: it seems the user clicked the Stop button in your browser.

I suspect his timeout problem, but not sure if he is at the passenger or ngnix level.

I tried to set various ngnix timeout options to a higher value, but that did not help.

proxy_read_timeout 400s; client_body_timeout 180s; keepalive_timeout 180s; client_header_timeout 180s; **I suspect it might be some issue with passenger config, but not sure.** 

Can someone please let me know what I can do so that the request continues without a sudden end

+7
ruby-on-rails ruby-on-rails-3 nginx passenger
source share
2 answers

This is file upload / download. For download I use in the appropriate place

 proxy_buffering off; proxy_request_buffering off; chunked_transfer_encoding on; client_body_timeout 3600; proxy_read_timeout 900; 

To download files I use

 client_max_body_size 10m; client_body_timeout 600s; 

(warning, if you have a return to a location in the corresponding location, it should be set in the first place)

Or some event via http? With a piece? Keepalive? For a piece, I use:

 proxy_buffering off; proxy_buffer_size 4k; proxy_request_buffering off; proxy_cache off; underscores_in_headers on; 

(for information about a piece, NGINX fixed an old bug in 1.11.2 if chunk with sub_filter directives)

In your browser, in the "Debug" window on the "Network" tab, which error or status is displayed after the request is denied?
Status code and / or response header?
Sometimes there may also be an answer / information in the Preview.

0
source

From your question it is not entirely clear who actually ends the request - the browser, nginx, or even the passenger himself.

The best practice for ensuring that a long-term HTTP connection is not collected and closed earlier is to ensure that some small data is always sent through the connection at regular intervals, for example, try sending a couple of spaces or comments every 90 seconds (or some of them), and see if this fixes the problem.

0
source

All Articles