Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-25 Thread Bojan Smojver
On Thu, 2004-03-25 at 06:22, Bill Stoddard wrote: My first inclination is to say make sure the file pointer is set to 0 before you send your brigade down the stack. Would that solve this particular case? However, emulate_sendfile() would still be broken in some pathological cases. For

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-24 Thread Bill Stoddard
Bojan Smojver wrote: I think I finally found the culprit. At first I thought it was the core_output_filter, but it turns out that emulate_sendfile (incorrectly) assumes that it is at the beginning of the file even when it's not. The attached patch works here when I have the combo of buckets as

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-23 Thread Bojan Smojver
Are you referring here to apr_file_seek() (which is done in emulate_sendfile() anyway) or to tracking the file position outside? On Tue, 2004-03-23 at 19:24, Cliff Woolley wrote: On Mon, 22 Mar 2004, William A. Rowe, Jr. wrote: I smell future bugs brewing - remember the handle may be dupped.

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-23 Thread Cliff Woolley
On Mon, 22 Mar 2004, William A. Rowe, Jr. wrote: I smell future bugs brewing - remember the handle may be dupped. Right... this is why we couldn't get away with that same trick in the buckets code. We tried. :) --Cliff

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-23 Thread Cliff Woolley
On Tue, 23 Mar 2004, Bojan Smojver wrote: Are you referring here to apr_file_seek() (which is done in emulate_sendfile() anyway) or to tracking the file position outside? I'm saying that file_bucket_read() does an apr_file_seek() unconditionally, because when we tried to have it remember what

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-23 Thread Bojan Smojver
On Tue, 2004-03-23 at 20:26, Cliff Woolley wrote: I'm saying that file_bucket_read() does an apr_file_seek() unconditionally, because when we tried to have it remember what the position was and bypass the seek if the position matched, file buckets were broken whenever the apr_file_t was

[PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bojan Smojver
I think I finally found the culprit. At first I thought it was the core_output_filter, but it turns out that emulate_sendfile (incorrectly) assumes that it is at the beginning of the file even when it's not. The attached patch works here when I have the combo of buckets as described below. The

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Cliff Woolley
On Tue, 23 Mar 2004, Bojan Smojver wrote: I think I finally found the culprit. At first I thought it was the core_output_filter, but it turns out that emulate_sendfile (incorrectly) assumes that it is at the beginning of the file even when it's not. The attached patch works here when I have

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bill Stoddard
Bojan Smojver wrote: I think I finally found the culprit. At first I thought it was the core_output_filter, but it turns out that emulate_sendfile (incorrectly) assumes that it is at the beginning of the file even when it's not. The attached patch works here when I have the combo of buckets as

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Cliff Woolley
On Mon, 22 Mar 2004, Bill Stoddard wrote: I took a 15 second look at the patch and have a concern (perhaps unfounded). apr_file_seek() is probably an expensive operation. If offset is 0, then in almost all cases (correct me if i'm wrong) the fileptr will be at offset 0 as well, right? So

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bojan Smojver
On Tue, 2004-03-23 at 07:48, Bill Stoddard wrote: I took a 15 second look at the patch and have a concern (perhaps unfounded). apr_file_seek() is probably an expensive operation. If offset is 0, then in almost all cases (correct me if i'm wrong) the fileptr will be at offset 0 as well,

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bojan Smojver
On Tue, 2004-03-23 at 07:48, Bill Stoddard wrote: I took a 15 second look at the patch and have a concern (perhaps unfounded). apr_file_seek() is probably an expensive operation. I've had a quick look at apr_file_seek() function and the cost depends on how the file is opened. If it's

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bojan Smojver
On Tue, 2004-03-23 at 12:40, Bojan Smojver wrote: I did two quick benchmarks with sendfile() support turned off in order to determine rough impact of the patch on emulate_sendfile() and the whole of Apache (prefork MPM). Just did another set of runs on the same machine (this time 100,000

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread William A. Rowe, Jr.
At 03:42 PM 3/22/2004, Bojan Smojver wrote: You are correct, it is probably an expensive operation. The other way would be to know the position within a file and compare it to the one that we should go to. If they are the same, do nothing. I smell future bugs brewing - remember the handle may be

Re: [PATCH]: emulate_sendfile fix [WAS]: File buckets v. core_output_filter

2004-03-22 Thread Bojan Smojver
Yeah, it doesn't look good. The best I could come up with so far is the apr_file_seek() every time. At least we know where we going to end up. On Tue, 2004-03-23 at 14:19, William A. Rowe, Jr. wrote: At 03:42 PM 3/22/2004, Bojan Smojver wrote: You are correct, it is probably an expensive