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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

752 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