EAGAIN (Resource temporarily unavailable)

Posted on 2003-03-14
Medium Priority
Last Modified: 2008-01-16
Hi all,

Lately I have been experiencing an odd error with Apache.  At times, a page would fail to download.  The error_log were not giving any clues, so I tried using strace.  Once I worked out with pid my request was being served by, I attached strace and made requests until one demonstrated the problem.  The strace output is as follows.  I am running Linux (RedHat) with Apache 1.3.27.

writev(3, [{"HTTP/1.1 200 OK\r\nDate: Thu, 13 M"..., 308}, {"fe7\r\n",5}, {"<!DOCTYPE HTML PUBLIC \"-//W3C//D"..., 4071}, {"\r\n", 2}], 4) =4386
read(7, 0xbffef860, 8192)               = -1 EAGAIN (Resource temporarily unavailable)
select(8, [7], NULL, NULL, NULL)        = 1 (in [7])
read(7, "d></tr>\n</table>\n<img src=\"http:"..., 8192) = 4096
writev(3, [{"1000\r\n", 6}, {"d></tr>\n</table>\n<img src=\"http:"..., 4096}, {"\r\n", 2}], 3) = 4104
read(7, 0xbffef860, 8192)               = -1 EAGAIN (Resource temporarily unavailable)
select(8, [7], NULL, NULL, NULL)        = 1 (in [7])
read(7, 0xbffef860, 8192)               = -1 EAGAIN (Resource temporarily unavailable)
select(8, [7], NULL, NULL, NULL)        = 1 (in [7])
read(7, "F4F4\"><font face=\"Arial,Helvetic"..., 8192) = 4096
writev(3, [{"1000\r\n", 6}, {"F4F4\"><font face=\"Arial,Helvetic"...,4096}, {"\r\n", 2}], 3) = 4104
read(7, 0xbffef860, 8192)               = -1 EAGAIN (Resource temporarily unavailable)
select(8, [7], NULL, NULL, NULL)        = 1 (in [7])
read(7, "=\"Arial,Helvetica,sans-serif\" si"..., 8192) = 4096
writev(3, [{"1000\r\n", 6}, {"=\"Arial,Helvetica,sans-serif\" si"...,4096}, {"\r\n", 2}], 3) = 4104
read(7, 0xbffef860, 8192)               = -1 EAGAIN (Resource temporarily unavailable)
select(8, [7], NULL, NULL, NULL)        = 1 (in [7])
read(7, "=\"2\"><strong><a href=\"http://www"..., 8192) = 4096
writev(3, [{"1000\r\n", 6}, {"=\"2\"><strong><a href=\"http://www"...,4096}, {"\r\n", 2}], 3) = 1918
--- SIGCHLD (Child exited) ---

Doing a bit of digging shows that the error may be related to limits the apache user has been set, and it hitting these limits?  Its quite a busy server, plus the requests Apache is processing, when the error is experienced, are very dynamic pages, so it does execute Perl a few times (though side server includes) - we are looking at mod_perl, but would like to try and get to the bottom of this problem first.

Any points, or possible solutions?  Thanks.

Question by:jon18_uk

Author Comment

ID: 8137795
I thought I better add a bit of background.  The apache the site in question is based on also hosts some other sites of ours, which again use high numbers of Perl scripts.  These do not have the problem, or which you can see anyway.

The problem normally happens when you refresh a page, for example, visit the site, and it loads, press refresh moments later, and the request will fail.  The page would part download, and then the browser will request the page again, which would then work.  As the strace shows I think, the child process handling the requests dies, hence the termination of the request to the browser - then the browser re-requests the page, and hence a new child process is used for it.

There is no core dump or clues in the error log.  I couldn't see how to turn on apache debug, "LogLevel debug" (replacing the current LogLevel) didn't make a different to what was logged, apart from some other info details like the build date.

Anyway to turn on the debug, so it walks though what Apache does?
LVL 15

Accepted Solution

samri earned 300 total points
ID: 8143087
Hi Jon,

First of all - your problem do sounds too technical.  Anyway, I'll try to help with "not soo technical" approach.

Yes it may look like you Apache is hitting "some" limits here.  Please could you try to turn-on ExtendedStatus, and monitor your Apache.
Uncomment the following directive in your httpd.conf and make sure mod_status is loaded.

ExtendedStatus On

<Location /server-status>
    SetHandler server-status
    Order Deny,Allow
    Deny from all
    Allow from your-ip

-- from (http://httpd.apache.org/docs/mod/mod_status.html).  

The details given are:

The number of children serving requests
The number of idle children
The status of each child, the number of requests that child has performed and the total number of bytes served by the child (*)
A total number of accesses and byte count served (*)
The time the server was started/restarted and the time it has been running for
Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request (*)
The current percentage CPU used by each child and in total by Apache (*)
The current hosts and requests being processed (*)

Since most of your pages are dynamic (Perl CGI, I presume), you could turn on logging for CGI sripts (http://httpd.apache.org/docs/mod/mod_cgi.html).  It may not do much (as compared to strace,) but it may give you some hint, on what is failing, and why (probably).

There is some discussion (which may/not be related);


Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question