Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

May 15, 2005

Apache and Tiger

I’ve been taking a little vacation from blogging. We will return to your regularly-scheduled programming soon.

However, I did want to bring up one very serious bug that may be affecting some of my visitors.

In the comment thread to my WebDAV post, Andreas Amann points out that there seems to be a serious incompatibility between MacOSX 10.4 and Apache 2.0.x.

I had not noticed any such problem exchanging 200 KB PDF files under WebDAV. The reason — as I will explain below — is that the Apple Finder WebDAV client is clever enough to hide the problem from me.

The problem seems to be that, while the server thinks it’s sent the entire file, the client receives only the first 70 KB or so, and then sits there till the connection times out. Here’s what happens when you retrieve the front page of this blog:

% curl  -O http://golem.ph.utexas.edu/~distler/blog/index.shtml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 77636    0 77636    0     0   4915      0 --:--:--  0:00:15 --:--:--     0
curl: (18) transfer closed with outstanding read data remaining

Of the 15 seconds that elapsed, the first 5 were spent retrieving data. During the remaining 10 seconds, the client didn’t get another byte.

On the other hand, the server thinks it sent the whole file successfully:

adsl-69-109-79-66.dsl.snfc21.pacbell.net - - [15/May/2005:12:34:21 -0500] "GET /~distler/blog/index.shtml HTTP/1.1"
200 181988 "-" "curl/7.13.1 (powerpc-apple-darwin8.0) libcurl/7.13.1 OpenSSL/0.9.7b zlib/1.2.2"

(Note the 200 “Success” Status code and the correct length of the page.)

The reason you, dear reader, have not encountered this problem is that your browser accepts compressed content

% curl --compressed -O http://golem.ph.utexas.edu/~distler/blog/index.shtml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49008  100 49008    0     0  32303      0  0:00:01  0:00:01 --:--:-- 43057

When sent compressed, the page is well shorter than the size at which MacOSX 10.4 and Apache 2.0.x crap out.

The Apple WebDAV client also appears to have no problem. When it receives the truncated file from the first GET request, it follows up with a series of “Partial Content” GET requests, until it succeeds in retrieving the entire file. The Apache logs record the initial request as having succeeded with a 200 Status Code, and then the subsequent requests with a 206 (“Partial Content”) Status Code.

Other, less sophisticated clients, like the W3C Validator (for some reason, lots of visitors like to check the validity of the front page of this blog) meekly accept the partial content and try to do the best they can with it.

For what it’s worth, my version of Apache is freshly-compiled using gcc 4.0:

Apache/2.0.54 (Unix) DAV/2 mod_ssl/2.0.54 OpenSSL/0.9.7g PHP/5.0.4

This is a very serious bug, affecting MacOSX 10.4 (Tiger) and Apache. I hope the good folks at Apple and the Apache Foundation find a solution soon.

In the meantime, if you do encounter truncated content from this server, try hitting Reload.

Update (5/25/2005):

Having a name for the problem is half the battle. Bug 34332. And, thanks to the great Wilfredo Sanchez, there’s even a fix. His patch works for the current APR trunk. But this one works against the APR version distributed with Apache 2.0.54.

Hallelujah! My webserver is working again!

Posted by distler at May 15, 2005 7:50 PM

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/573

28 Comments & 2 Trackbacks

Re: Apache and Tiger

Hi,
It would be very nice if you could make it clear exactly WHAT the interaction between Tiger and Apache 2.0 that you are discussing is.
I have read the entire post carefully and I still cannot tell if what you are describing is
* Safari on Tiger has a problem with generic Apache 2 servers OR
* Apache 2 on Tiger has a problem.

Beyond that, if the problem is Apache 2 on Tiger, doesn’t at least Tiger Server come with Apache 2 as an option? So what’s the story there; does that one work?

Posted by: Maynard Handley on May 21, 2005 4:21 AM | Permalink | Reply to this

Re: Apache and Tiger

Sorry, I thought it would be clear from the linked-to discussion.

When running on Tiger (currently 10.4.1), Apache (currently 2.0.54, but in desperation, I’ve also tried 2.1.3beta), will only send about 74KB in response to a GET request. If you request a file larger than that, the request will just hang waiting for data.

You are mostly safe viewing stuff hereabouts because

  1. I have mod_deflate turned on, which means that most responses are sent compressed (keeping them below the 74KB cutoff).
  2. Your client supports ‘partial content’ GETs, and so succeeds in pulling in the rest of the data by asking for the subsequent pieces of the file after the first GET times out.

I don’t know what the deal with MacOSX Server is, but I would be very interested in knowing whether Apache 2 running on 104.x Server suffers from the same problem.

Posted by: Jacques Distler on May 21, 2005 11:09 AM | Permalink | PGP Sig | Reply to this

Re: Apache and Tiger

Thanks for the update (and letting me know that I am not the only one:-) - I might get adventurous again and try to update my server to Tiger (after having done about five re-installs before reverting back to 10.3 I have been getting pretty good at it…)

Posted by: Andreas Amann on May 25, 2005 11:18 PM | Permalink | Reply to this

Success!

I decided to give this a try and it indeed worked!

Here is a step-by-step rundown of what I did:

  1. Apply the patch to the httpd-2.0.54 source
  2. Re-compile and install the patched Apache while still running 10.3.9
  3. Test ther server (including WebDAV and Subversion) - everything still works as expected
  4. Upgrade to 10.4.1 - everything is still fine without re-compiling
  5. Recompile Apache (with patch still applied) using gcc4
  6. Run some tests (again, including WebDAV and Subversion) - everything is still OK, no breakage
  7. Re-compile Subversion 1.2.0 (linked to the APR compiled before) - make check returns success
  8. Run some stress tests for Subversion (direct access as well as access via viewcvs using the python bindings) and WebDAV (retrieving 1.6GB file using the Finder) - everything is OK

Some additional comments:

  1. I also have this patch applied to my Server so that it properly reports the free disk space on my server instead of the generic value
  2. In order to get rid of tons of “uri mismatch” entries in my error log a followed this hint to adjust my httpd.conf settings
  3. According to Michele Fuortes as reported on MacinTouch, the Apache2 shipped with Tiger Server does indeed exhibit the same problem.

Thanks again for finding the links to the patch to get Apache2 to work correctly on Tiger and pointing them out here - I now am a happy camper again running my server on 10.4.1!

Posted by: Andreas Amann on May 29, 2005 12:04 AM | Permalink | Reply to this

Re: Success!

Glad to see it worked for you.

I dashed off a note to Macintouch in response to Michele Fuortes’s complaint.

In retrospect, I’m really surprised Apple released MacOSX Server knowing that this bug existed. (Note that the bug report was filed by an Apple employee on April 6.) Having a broken httpd is an utter showstopper for a Server OS.

Posted by: Jacques Distler on May 29, 2005 2:21 AM | Permalink | PGP Sig | Reply to this

Re: Success!

I had sent a response to Macintouch as well - at least they should then really believe that it can be done and add it to their report:-)

You are right abou the timeline for the server release - I hadn’t even thought about that - I guess they were just completely clueless on how to fix things (and then, seeing that some of the bugs I filed more than two years ago have still not been fixed, I guess Apple seems to have a different opinion on what bugs are important enough to fix…)

Posted by: Andreas Amann on May 29, 2005 2:29 PM | Permalink | Reply to this

Re: Success!

I had sent a response to Macintouch as well - at least they should then really believe that it can be done and add it to their report:-)

Both just appeared on the front page of Macintouch. The one bit of awkwardness is that your report directs people to the patch for the current APR 1.1 Trunk, rather than to the (not quite identical) patch for for APR 0.96, which is what is used in Apache 2.0.54.

I’m sure people will figure it out, though.

Anyways, I gather the bug is fixed in the next Apache release, so this will, hopefully, soon be moot.

You are right abou the timeline for the server release - I hadn’t even thought about that - I guess they were just completely clueless on how to fix things (and then, seeing that some of the bugs I filed more than two years ago have still not been fixed, I guess Apple seems to have a different opinion on what bugs are important enough to fix…)

Bugs are bugs, but I would have major trepidations about releasing a Server OS that couldn’t reliably serve web pages. People who are running their e-businesses on XServe’s might get kinda pissed…

Posted by: Jacques Distler on May 29, 2005 8:31 PM | Permalink | PGP Sig | Reply to this

Re: Success!

Yes, we had to bring in a unix guru to suss this, and the fix is fairly geeky too!
Apple should not have let Tiger Server out of the door without testing, finding and fixing this bug!

Posted by: Bart Hanson on March 19, 2006 4:16 PM | Permalink | Reply to this

Re: Success!

Would you happen to know of a web site where I could find step-by-step instructions on how to apply the Apache2/10.4 patch?

I’ve got Apache running, but I’m a UNIX newbie.

Thanks.

Posted by: Jim Coyle on May 29, 2005 9:14 PM | Permalink | Reply to this

patch

To learn how to use diff and patch, open up a Terminal window and type “man patch” or “man diff”.

In brief, patching, compiling and installing the new Apache is as simple as:

cd [Build Directory]
curl -O http://golem.ph.utexas.edu/~distler/blog/files/sendrecv.c.patch
patch < sendrecv.c.patch
./configure --enable-mods-shared=all
make
sudo make install
Posted by: Jacques Distler on May 29, 2005 9:58 PM | Permalink | PGP Sig | Reply to this

Re: patch

Thanks for the help! I installed a binary version of Apache 2.0.52 originally. Do I need to get the source version of 2.0.54 before I can apply the patch, or can I patch the version I have?

Thanks again.

Posted by: Jim Coyle on May 30, 2005 8:48 PM | Permalink | Reply to this

Re: patch

Well … umh … since you’re patching the source, configuring, and then compiling, having the source on hand is … a prerequisite.

Posted by: Jacques Distler on May 30, 2005 9:27 PM | Permalink | Reply to this

Re: patch

Thanks again….

I’ve downloaded the 2.0.54 files, and in Terminal have changed to that directory.

I’ve had no problem downloading the patch, however, when I go to “patch Thanks again….

I’ve downloaded the 2.0.54 files, and in Terminal have changed to that directory.

I’ve had no problem downloading the patch, however, when I go to “patch < sendrecv.c.patch” I’m asked what file I want to patch…which I don’t know! Would you tell me please? Thanks.

Posted by: Jim Coyle on May 30, 2005 10:11 PM | Permalink | Reply to this

Re: patch

Wilfredo Sanchez has placed pre-built packages on his iDisk with the patch included.

Posted by: Kelvin McDowell on May 31, 2005 9:10 PM | Permalink | Reply to this

Alpha version

He’s offering a pre-built Apache2.1.4alpha. If you’re interested in a patched version of the stable release, Apache2.0.x, you’ll have to use the patch given here and compile your own.

There are enough differences between 2.0.x and 2.1.x, that many people may prefer to stick with the former, for the present.

Posted by: Jacques Distler on June 1, 2005 7:54 AM | Permalink | PGP Sig | Reply to this

Re: patch

Your post is incomplete, but I think you were going to say that the patch couldn’t find the file to patch. this is a bit odd as the path does seem right, but if you apply the patch as stated, then when it asks you can give the relative path to the actual file to patch which is:

File to patch: srclib/apr/network_io/unix/sendrecv.c

Then continue with configure and make as stated.

Also note that the build directory is NOT the ‘build’ directory, but the top level of the extracted tarball, i.e. your current path when you configure will probably end in /httpd-2.0.54

Posted by: Marcus Bointon on June 8, 2005 3:51 AM | Permalink | Reply to this

Re: Apache and Tiger

All you “experts” make it hard for us virgins (read newbies) to understand exactly what to do to solve this issue and fix our server.

Can someone provide step-by-step instructions, like:
1) Obtain latest stable source (v2.054) from apache.net
2) Obtain (DL) the latest patch from xxx.xxx
3) assemble source and patch in xxx directory
4) make/configure script
etc.

Thanks in advance….stephen

Posted by: BigKid on July 2, 2005 3:44 PM | Permalink | Reply to this

Re: Apache and Tiger

download httpd-2.0.54.tar.bz
tar xvjf httpd-2.0.54.tar.bz
cd [Build Directory]
curl -O http://golem.ph.utexas.edu/~distler/blog/files/sendrecv.c.patch
patch download httpd-2.0.54.tar.bz
tar xvjf httpd-2.0.54.tar.bz
cd [Build Directory]
curl -O http://golem.ph.utexas.edu/~distler/blog/files/sendrecv.c.patch
patch < sendrecv.c.patch
File to patch: srclib/apr/network_io/unix/sendrecv.c
./configure –prefix=/usr/local/apache2 –enable-modules=all –enable-mods-shared=all –enable-so –enable-static-support –enable-ssl –enable-proxy –enable-deflate
make
sudo make install

Posted by: medusa on July 3, 2005 4:42 AM | Permalink | Reply to this

Re: Apache and Tiger

For those other newbies who have had trouble reading this fix, it’s presented wrong! Here’s the corrected code:

download httpd-2.0.54.tar.bz2
tar xvjf httpd-2.0.54.tar.bz2
cd [Build Directory]
curl -O http://golem.ph.utexas.edu/~distler/blog/files/sendrecv.c.patch
patch File to patch: srclib/apr/network_io/unix/sendrecv.c
./configure -prefix=/usr/local/apache2 -enable-modules=all -enable-mods-shared=all -enable-so -enable-static-support -enable-ssl -enable-proxy -enable-deflate
make
sudo make install

Posted by: Mark Howells on September 19, 2005 10:59 AM | Permalink | Reply to this

Re: Apache and Tiger

I’ve run into the 64k limit bug when I upgraded to Mac OS 10.4 and following the above instructions I actually managed (me being a unix newbie - so no small feat!) to follow the instructions and get the install to work… the only problem is I keep getting this cryptic error when I try to manually start up Apache (where/how would one set Apache2 to start up at system start up?). I navigate to the directory with apache2 (usr/local/apache2/bin) and enter the command ./httpd whereupon I get the immediate error of

“Syntax error on line 2 of /usr/local/apache2/conf/httpd.conf:
Invalid command ‘/mod_auth.so’, perhaps mis-spelled or defined by a module not included in the server configuration”

Huh? Line 2? there is nothing on line 2 of the file?

I have changed nothing from the install except of course to modify the httpd.conf file to reference my website… but I did not modify any other aspect of it… so why am I gettting these errors being that this is exactl what the “sudo make install” command produced and how do I fix this?

I tried commenting out the offending lines but it never would work no matter what I commented or deleted… I eventually commented out every single “Load module” line and it still insisted there was an error with a commented line??”

I’m at my wit’s end with this thing… I think I’m 99% there but can’t just get past this cryptic unhelpful error.

Any help would be greatly apreciated. And remember I’m a unix newbie so feel free to spell out a solution in the most basic of terms ;-)

Posted by: Greg Morin on July 29, 2006 12:59 PM | Permalink | Reply to this

Re: Apache and Tiger

BTW… *thank you* for posting that link about httpd.conf. I’ve been struggling for a while with 10.4 and Apache 2 running on Solaris, mostly because I use WebDAV as a cross-platform (Win*cough*, Mac, and Unix) file service for things like my photo library, music, etc. And the issue with the WebDAVFS version change really stymied me. To avoid future problems – and presuming this issue won’t be resolved anytime soon, or maybe even in the 1.x chain – I’d suggest making a more general modification to the WebDAVFS BrowserMatch directive, so that it matches any 1.x release rather than calling out specific ones.

What really peeves me is that Apple would have known full well that it was releasing a few WebDAV version and *should* have called that out in the release notes.

Posted by: Bill Taroli on July 4, 2005 2:07 PM | Permalink | Reply to this

Patch generates high load: alternate, easier fix

Hello,

Another Google searcher here. Thanks, Jacques!

I tried applying the patch to our (relatively high volume) web server, and found quickly that our server load increased significantly, especially any time a user downloaded a large (multi-megabyte) file. This would be bad in the long-term.

Looking through the bug thread, and possibly confirming the high load problem, Wilfredo concluded here that “that there is some busy-waiting going on” in the patch. Joe had another idea earlier.

The best temporarily solution I’ve found seems to be “disabling poll” before compiling Apache. Do this by typing:

export ac_cv_func_poll=no

into your shell right before doing your typical:

./configure […]

and building Apache.

This fixed the hang for me, AND fixed the high load for me. Fingers crossed. I hope it works for you as well.

Sincerely,
Cabel / Panic

Posted by: Cabel Sasser on July 11, 2005 4:09 AM | Permalink | Reply to this
Read the post Apache2 on Tiger still borked
Weblog: toxicsoftware.com
Excerpt: With the release of Mac OS X 10.4.2 Server I was hoping the problem I've been seeing with Apache2 trying to serve files greater than 64KB in length had been fixed. Of course I'm not the only one coming up across this problem, search for &q...
Tracked: July 13, 2005 10:50 AM

Re: Apache and Tiger

Tiger busted me on my domain host’s Apache 1.3.33 – and I have no clue what mod_dav version I’ve got.

It was working TERRIFIC under Panther.

Does this approach have any applicability to 1.3.33?

Posted by: ADW on July 15, 2005 11:06 AM | Permalink | Reply to this

Re: Apache and Tiger

I just wanted to send my many, many thanks.. I toiled over this for some time knowing where the problem existed, but not the fix.. so thank you all for the tips and direction. very much appreciated.

Posted by: D.Hayes on August 7, 2005 8:01 PM | Permalink | Reply to this

Re: Apache and Tiger

Thanks to all of you for doing such a good job for the rest of us!
Wanting to setup Apache 2.0.54 I read all this. But in the end I found out that OS X Server 10.4.3 and up have Apache 2.0.54 *and* the patch already installed right out of the box. See:
http://docs.info.apple.com/article.html?artnum=302089
Just waiting for Server Admin to support Apache 2 too.

Posted by: Doingwell on January 27, 2006 8:56 AM | Permalink | Reply to this

Re: Apache and Tiger

So does the newest Apache (2.2) fix this problem or does it still need a patch?

Posted by: Kestrel on February 4, 2006 8:15 PM | Permalink | Reply to this

Re: Apache and Tiger

2.0.55 fixes this bug. I’ve had my share of problems with 2.2.0, and ended up moving to 2.3.0dev.

Moving from 2.0.x to 2.3.0 involves substantial changes to your httpd.conf file, so I wouldn’t recommend it, unless you are feeling particularly cutting-edge.

Posted by: Jacques Distler on February 4, 2006 8:42 PM | Permalink | PGP Sig | Reply to this

Re: Apache and Tiger

I would suggest you too this issue isn’t new…

I encountered at first with Apache 2.0.52 Serverlogistics.com package

it would serve files via http ,simple directory listing
The transfers start, but safari…and explorer too..
it close “correctly” the file transfer when are 10-84 k..
???

Anyway, as a bad unix user,i
would hope, some good man, would share an osx binary to solve the stress of several old-mac readers like me :)

Thanks for all

Dan

Posted by: Dan on July 11, 2006 6:44 PM | Permalink | Reply to this
Read the post Leopard
Weblog: Musings
Excerpt: Not a complete vale of tears.
Tracked: November 18, 2007 11:59 AM

Post a New Comment