You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/05/23 22:34:30 UTC

DO NOT REPLY [Bug 45071] New: Sendfile on APR connector can truncate downloads.

https://issues.apache.org/bugzilla/show_bug.cgi?id=45071

           Summary: Sendfile on APR connector can truncate downloads.
           Product: Tomcat 6
           Version: 6.0.16
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: alex@planet-barclay.com


Created an attachment (id=21992)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21992)
Patch to alter APR sendfile thread timeout behavior

The APR connector currently sets a TTL on the socket in its poller loop.
Unfortunately this TTL is based on soTimeout and refers to the entire download.

This manifests itself during large file downloads (our app is around 5-10MB).
The Poll.maintain(...) fires and the socket gets closed mid-transfer.

The attached patch changes this behavior such that the TTL is reset on socket
activity. This now means that inactivity of 20 secs (the default from
server.xml (connectionTimeout) applies to each write. So long as the client is
taking data, albeit slowly, the transfer will be allowed to continue.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071


Alex Barclay <al...@planet-barclay.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21992|0                           |1
        is obsolete|                            |




--- Comment #1 from Alex Barclay <al...@planet-barclay.com>  2008-05-23 13:39:14 PST ---
Created an attachment (id=21993)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21993)
A better version of the patch

The first patch I attached contained this fix and another one. This patch is
now correct.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071


Alex Barclay <al...@planet-barclay.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




--- Comment #5 from Alex Barclay <al...@planet-barclay.com>  2008-05-29 10:41:49 PST ---
We didn't quite fix this, instead we uncovered an underlying issue.

In do_remove the list of descriptors is shuffled down as a descriptor is
removed. Unfortunately the socket_ttl array was forgotten. This manifests
itself as a truncated downloads on a seemingly random basis. What's actually
happening is as a descriptor is removed the next higher descriptor inherits its
TTL which could be close to expiry.

It would probably have been better to hold both the ttl and socket descriptor
in a structure in a single array but this fix is only one line.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071





--- Comment #6 from Alex Barclay <al...@planet-barclay.com>  2008-05-29 10:44:17 PST ---
Created an attachment (id=22034)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22034)
Make sure that the socket_ttl array is moved down as the socket_set array is

I've been testing this for a couple of days and haven't seen any more sendfile
truncation. Hopefully this is the last part.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071


Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Remy Maucherat <re...@apache.org>  2008-05-26 08:58:23 PST ---
Fixed in tomcat-native: http://svn.apache.org/viewvc?rev=660175&view=rev


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071





--- Comment #2 from Remy Maucherat <re...@apache.org>  2008-05-25 08:24:12 PST ---
This should be fixed in the native code.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071





--- Comment #3 from Remy Maucherat <re...@apache.org>  2008-05-25 09:33:36 PST ---
(In reply to comment #1)
> Created an attachment (id=21993)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21993) [details]
> A better version of the patch
> 
> The first patch I attached contained this fix and another one. This patch is
> now correct.

I reviewed this patch, and it should work. It implies that maintain() cannot
work with poll(false), while using maintain is more or less mandatory. If not
fixing the native code, poll(false) needs to be removed.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 45071] Sendfile on APR connector can truncate downloads.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45071


Mladen Turk <mt...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #7 from Mladen Turk <mt...@apache.org>  2008-05-29 11:09:22 PST ---
Commited. Thanks!


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org