Request processing time for apache+Passenger+Rails is too long

Asked 2 years ago, Updated 2 years ago, 50 views

This is my first time posting a question.Thank you for your cooperation!

  • Apache/2.2.15(Unix)
  • Phusion Passenger version 4.0.42
  • Rails 3.2.18

I would like to ask you a question as the title says, but I am troubled because I do not know the cause.
I set the timeout for apache to 120 seconds, but there are very rare and unexpected defects, and when I looked into the cause, I found out
The apache access log is

[19/Nov/2015:07:35:37+0900] "GET/XXX HTTP/1.1" 200 66369825
[19/Nov/2015:07:30:34+0900] "GET/XXX HTTP/1.1"2007201738623
[19/Nov/2015:09:45:02+0900] "GET/XXX HTTP/1.1" 200 33323601

It looks like this, and the Status has returned 200 even though it is clearly over 120 seconds.
I checked the Rails log and found that the log in the first line of the action called is as follows:

[2015-11-1907:35:38] Hoge#fugacalled
[2015-11-1909:30:34] Hoge#fugacalled
[2015-11-1909:45:03] Hoge#fugacalled

The following processing has been completed as if nothing had happened.
In other words, the communication that came to apache at 07:30 was 09:30, and it suddenly seemed as if nothing had happened
The log appears to have been successfully processed.

Why did this happen?Is there any way to prevent it?
I don't mind if it's small, so please let me know.

Ideally, it would be nice to return an error status such as 500 instead of processing a request that is more than 120 seconds old.

Thank you for your cooperation.

ruby-on-rails apache

2022-09-30 17:59

1 Answers

If you look at Apache's log, the timestamps have changed.
This is due to Apache log output timing, and you can see that Passenger and Rails are slow.

In other words, the communication that came to apache at 07:30 was 09:30 and suddenly nothing happened

I think that's what it is ↓

7:30 a.m. apache(A) request has arrived
7:35 A request for apache(B) has arrived
Apache returned a response after dawn (B) → 7:35 logs are printed
Around 9:30 (A) ends Apache returned a response → 7:30 log is output

Apache's Timeout is the timeout for receiving requests, so if the request is too long to respond, it will not timeout.

Is it possible to set the timeout in Passenger or Rails?
(I am not sure about this, so I cannot answer.I'm sorry.)


2022-09-30 17:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.