Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

APR does not understand this error code

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


thomas at delos

May 10, 2011, 12:15 PM

Post #1 of 7 (2446 views)
Permalink
APR does not understand this error code

Hi,

I am still having these errors for my modperl installation on windows.

I use the lates Modperl 2.05 and hava tested with Perl 5.10.1 and 5.12
(activestate) but both give the same results.

Also tested on Windows 2003 and 2008 server.

The full error is: Apache2 IO flush: (620018) APR does not understand this
error code at -e line 0

This error happens if the loading of a web page is aborted while not all
data is send to the client.

After this the current child process restarts.

In http://www.gossamer-threads.com/lists/modperl/dev/102357 it
looks like it is solved.

Does this path not work ?
Can anyone help me with this ?

--
Thomas den Braber


JDeighan at pcgus

May 10, 2011, 1:39 PM

Post #2 of 7 (2394 views)
Permalink
RE: APR does not understand this error code [In reply to]

We were getting this behavior in our web application. It appears that we've fixed it (we're still testing it) by checking the return value from each print statement (usually we call the Apache request object's print method) and aborting (by calling die() in our application - we have an all-encompasing try block) if print returns a false value. I would give that a try.
________________________________________
From: Thomas den Braber [thomas [at] delos]
Sent: Tuesday, May 10, 2011 3:15 PM
To: modperl List
Subject: APR does not understand this error code

Hi,

I am still having these errors for my modperl installation on windows.

I use the lates Modperl 2.05 and hava tested with Perl 5.10.1 and 5.12
(activestate) but both give the same results.

Also tested on Windows 2003 and 2008 server.

The full error is: Apache2 IO flush: (620018) APR does not understand this
error code at -e line 0

This error happens if the loading of a web page is aborted while not all
data is send to the client.

After this the current child process restarts.

In http://www.gossamer-threads.com/lists/modperl/dev/102357 it
looks like it is solved.

Does this path not work ?
Can anyone help me with this ?

--
Thomas den Braber


thomas at delos

May 11, 2011, 8:15 AM

Post #3 of 7 (2385 views)
Permalink
RE: APR does not understand this error code [In reply to]

> We were getting this behavior in our web application. It appears that
> we've fixed it (we're still testing it) by checking the return value
> from each print statement (usually we call the Apache request object's
> print method) and aborting (by calling die() in our application - we
> have an all-encompasing try block) if print returns a false value. I
> would give that a try.
> ________________________________________

I was thinking about that solution to, but that makes the code less clean,
all the if statements makes it harder to read.

I think it is better to fix this in Mod Perl than making workaround.
Especially for newbies or CGI migrate project that have lots of existing code.


torsten.foertsch at gmx

May 11, 2011, 9:23 AM

Post #4 of 7 (2386 views)
Permalink
Re: APR does not understand this error code [In reply to]

On Wednesday, May 11, 2011 17:15:19 Thomas den Braber wrote:
> I think it is better to fix this in Mod Perl than making workaround.

Patches are welcome, really. Currently, we are quite short of Windows
programmers.

Torsten Förtsch

--
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


torsten.foertsch at gmx

May 17, 2011, 12:08 PM

Post #5 of 7 (2349 views)
Permalink
Re: APR does not understand this error code [In reply to]

On Tuesday, May 10, 2011 21:15:29 Thomas den Braber wrote:
> In http://www.gossamer-threads.com/lists/modperl/dev/102357 it
> looks like it is solved.

Thomas, could you please check if the patch at

http://www.gossamer-threads.com/lists/modperl/dev/102983#102983

fixes your problem? It sounds quite similar. BTW, I have tried to
reproduce the problem on Linux without success.

On Tuesday, May 17, 2011 17:27:29 Steve Hay wrote:
> Any thoughts on whether this change is good to commit?

Steve, I have tried your patch on my linux box. It passes all tests
successfully. So, I think go ahead and commit it.

One thing I don't catch, can this thing happen only in
mpxs_Apache2__RequestRec_rflush()? I believe it can also happen in all
the other write operations. If the process crashes on this error I think
they should also be fixed. Though, without a proper test case it's like
fishing in murky waters.

Torsten Förtsch

--
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


SteveHay at planit

May 18, 2011, 2:08 AM

Post #6 of 7 (2338 views)
Permalink
RE: APR does not understand this error code [In reply to]

Torsten Förtsch wrote on 2011-05-17:
> On Tuesday, May 10, 2011 21:15:29 Thomas den Braber wrote:
>> In http://www.gossamer-threads.com/lists/modperl/dev/102357 it
>> looks like it is solved.
>
> Thomas, could you please check if the patch at
>
> http://www.gossamer-threads.com/lists/modperl/dev/102983#102983
>
> fixes your problem? It sounds quite similar. BTW, I have tried to
> reproduce the problem on Linux without success.
>
> On Tuesday, May 17, 2011 17:27:29 Steve Hay wrote:
>> Any thoughts on whether this change is good to commit?
>
> Steve, I have tried your patch on my linux box. It passes all tests
> successfully. So, I think go ahead and commit it.
>
> One thing I don't catch, can this thing happen only in
> mpxs_Apache2__RequestRec_rflush()? I believe it can also happen in all
> the other write operations. If the process crashes on this error I think
> they should also be fixed. Though, without a proper test case it's like
> fishing in murky waters.
>

Ok, I'll commit that fix shortly.

There are indeed other print / write functions with the same MP_RUN_CROAK check in them which will throw an exception if an error (e.g. an aborted connection) occurs, but the solution there is to eval { } every print() call in your code (tedious if you print() HTML out line by line, but fine if you build up the page in memory and only output with a single print() call) and/or have an all-encompassing eval round the whole program.

I find it's always a good idea to wrap the whole program in an eval { } to catch any problem that might occur, but as long as you have an eval { } at some level around the print() call then you're safe. Stas suggested doing that as far back as 2005 when the same error was reported: http://marc.info/?l=apache-modperl&m=112347961618748&w=2.

And with SVN rev. 1052232 in place you can even now filter out lost connection errors and write an error page back in other cases where it is safe to do so.

My point here is that print() failures can (and must be!) caught and handled appropriately, whereas the troublesome flush failures seem to happen at a later stage and are not caught even by an all-encompassing eval { }, hence mod_perl should not be throwing those.

In fact, given that these flush failures apparently can't be caught, perhaps flush should never throw an exception? I've changed it so that it just logs lost connection errors rather than throwing an exception, but if any other kind of error occurs then it will still throw. I've never seen any other cause of flush failing in the wild, though, so perhaps if any other kind of error occurs then it really is an exceptional situation?

However, since I've also not been able to reproduce the problem myself and therefore don't fully understand what is happening, I've taken the approach of applying the least changes necessary to fix the problem.

(I even wonder about the whole style of throwing exceptions from the I/O code, in particular the PerlIO layer implemented in modperl_io_apache.c: the PerlIO manual (perliol.pod) talks of returning NULL or -1 from most functions to indicate failure, not throwing exceptions... The downside to that, though, is that it forces you to check the return value of every print() call, whereas if it throws an exception instead then you can lazily ignore it (it *is* generally unlikely to fail, after all), knowing that your all-encompassing eval { } will catch it if it does go wrong.)


thomas at delos

May 25, 2011, 2:41 AM

Post #7 of 7 (2303 views)
Permalink
Re: APR does not understand this error code [In reply to]

On May 26, 2011 09:36 Torsten wrote:
>
> Since I haven't heard from you I take it the problem has been resolved,
> has it? Did you try Steve's patch?
>

I have done a lot of testing on many different systems but still haven't
figured it out exactly when the problem occurs. I have found that on
windows 7 64 bit and 2008 64 bit with Perl 5.12 and apache 2.17 from
apachelounge the problem is NOT seen.
I was only able to reproduce the problem on windows 2003 and 2008 R1
server 32 bit. But even here it was very difficult to reproduce it in a
situation where Apache actually restarted.

I found that there where two occasions of the APR error.
One that gives the real line number where the problem occurred:
'APR does not understand this error code at /path/module line xxx'
This does not course the Apache to restart.

The other error is:
'Apache2 IO flush: (620018) APR does not understand this error code at -e
line 0'.
This causes Apache to restart.

The first error is seen in the log of the virtual host that runs the
ModPerl script. The other error is seen in the main apache error log file.

Any Idea what 'at -e' means ?

I have not tried Steve's patch yet, will do that asap.

Will be continued ..

--
Thomas den Braber

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.