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 2006/01/31 16:25:51 UTC

DO NOT REPLY [Bug 38464] New: - Data corruption when using APR

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464

           Summary: Data corruption when using APR
           Product: Tomcat 5
           Version: 5.5.14
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Connector:HTTP
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: bugzilla@schoenhaber.de


While fiddeling around WRT Bug 37788 I did some more intensive testing of the
APR-Connector and noticed that sometimes the transmitted data is corrupted or
the transmission stalls prematurely.
Two cases where I can reproduce this reliabally:
1. A listing of a directory containing ~ 2500 files will never be completely
shown in the broser - only ~ 500 files are shown (the exact number varies).
2. When trying to download the attached binary file (filled with random bytes)
using Firefox only part of the file will be transmitted. Doing the same with
wget results in the following:
$ LC_ALL=C http_proxy="" wget http://192.168.42.4:8080/t2.bin
--16:21:31--  http://192.168.42.4:8080/t2.bin
           => `t2.bin'
Connecting to 192.168.42.4:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 38,144 (37K) [application/octet-stream]

77% [==========================================================>               
  ] 29,656        --.--K/s    ETA 00:05

16:21:51 (1.45 KB/s) - Connection closed at byte 29656. Retrying.

--16:21:52--  http://192.168.42.4:8080/t2.bin
  (try: 2) => `t2.bin'
Connecting to 192.168.42.4:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 38,144 (37K), 8,488 (8.3K) remaining [application/octet-stream]

100%[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=================>]
38,144        --.--K/s

16:21:52 (33.87 MB/s) - `t2.bin' saved [38144/38144]

The downloaded file differs from the file on the server.
Wether useSendfile is set to false or not on the Connector doesn't make a
difference.

Neither of these problems shows up when using the pure Java Connector.

System spec:
Gentoo Linux with kernel 2.6.15-gentoo-r1
Sun JDK 1.5.0.06
APR 1.2.2
tomcat-native-1.1.1 from the 5.5.15 distribution
gcc 3.4.4
Stock Tomcat 5.5.15 (5.5.15 should be added to bugzilla's version field BTW)

Since I thought there might be some oddity with my Gentoo system, I installed
Kubuntu breezy badger (5.10) with kernel 2.6.12-10-386 and gcc 4.01 on another
machine and could reproduce both problems there.
I've also tested the file download (case 2.) on a Windows machine with Tomcat
5.5.15 - there ist works flawlessly.

BTW: although I mentioned Bug 37788 this issue is completely unrelated since I
did not use any modified components but the stock Tomcat 5.5.15.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


bugzilla@schoenhaber.de changed:

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




------- Additional Comments From bugzilla@schoenhaber.de  2006-02-07 15:37 -------
(In reply to comment #16)
> I do not find this convincing.

I do.
Aren't you interested in an AprConnector that actually works?


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


mturk@apache.org changed:

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




------- Additional Comments From mturk@apache.org  2006-02-07 10:45 -------
Right, you are correct.
For slow networks the actuall number written can be lower,
and inside InternalAprOutputBuffer we presume that all the
data has been written.

I'll create a patch, although I'm not sure wether it should
go in native or InternalAprOutputBuffer.
If it's implemented in native (already done that) it will follow the Java
OutputStream api, but in that case it would not follow the APR api.

I'll discuss that with other guys to see what they think.

Here a snippet for network.c that resolves that, so you can test it
and tell me if it's working for you too. I think it should because
I was able to duplicate the bug.

TCN_IMPLEMENT_CALL(jint, Socket, sendbb)(TCN_STDARGS, jlong sock,
                                         jint offset, jint len)
{
    tcn_socket_t *s = J2P(sock, tcn_socket_t *);
    apr_size_t nbytes = (apr_size_t)len;
    apr_size_t sent = 0;
    apr_status_t ss;

    UNREFERENCED_STDARGS;
    TCN_ASSERT(sock != 0);
    TCN_ASSERT(s->opaque != NULL);
    TCN_ASSERT(s->jsbbuff != NULL);
#ifdef TCN_DO_STATISTICS
    sp_max_send = TCN_MAX(sp_max_send, nbytes);
    sp_min_send = TCN_MIN(sp_min_send, nbytes);
    sp_tot_send += nbytes;
    sp_num_send++;
#endif

    while (sent < nbytes) {
	apr_size_t wr = nbytes - sent;
	ss = (*s->net->send)(s->opaque, s->jsbbuff + offset + sent, &wr);
	if (ss != APR_SUCCESS)
	    break;
	sent += wr;
    }
    if (ss == APR_SUCCESS)
        return (jint)sent;
    else {
        TCN_ERROR_WRAP(ss);
        return -(jint)ss;
    }
}

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


bugzilla@schoenhaber.de changed:

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




------- Additional Comments From bugzilla@schoenhaber.de  2006-02-07 15:05 -------
(In reply to comment #14)
> The Java patch applied is (hopefully it's correct, please test it):

No, doesn't work for me. The table.jsp gets corrupted. (It does work when a
tcnative with Mladen's patch is used - but that's beside the point, isn't it?)


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


remm@apache.org changed:

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




------- Additional Comments From remm@apache.org  2006-02-02 14:42 -------
(In reply to comment #4)
> Similar output has been reported: [1],[2]
> [1] http://marc.theaimsgroup.com/?l=tomcat-user&m=113711225801348&w=2
> [2] http://marc.theaimsgroup.com/?l=tomcat-user&m=113819615811780&w=2

The first one doesn't know what he's talking about, the second one is using a
build which has a buffering bug in some cases, while I will ignore the third one
(that's you) since he didn't read our replies.


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-02-06 13:28 -------
Created an attachment (id=17601)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17601&action=view)
JSP that creates a table with many rows. Default 1000, configure via rows
request param


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


mturk@apache.org changed:

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




------- Additional Comments From mturk@apache.org  2006-02-07 16:26 -------
Fixed in the SVN.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


mturk@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED




------- Additional Comments From mturk@apache.org  2006-02-07 12:08 -------
I think we'll made a patch in java instead tweaking native.
I spoke with Remy, and he'll try to update the usage of sendXX calls
to conform to APR api, that is similar to NIO.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-01-31 16:28 -------
Created an attachment (id=17548)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17548&action=view)
Binary file for download test


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-02-07 11:51 -------
(In reply to comment #11)
> Here a snippet for network.c that resolves that, so you can test it
> and tell me if it's working for you too. I think it should because
> I was able to duplicate the bug.

Yes, it's working for me too.

Thanks Mladen! I already began to think that THEY manipulated my Tomcat because
THEY had decided to drive me nuts.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


mturk@apache.org changed:

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




------- Additional Comments From mturk@apache.org  2006-01-31 17:44 -------
I doubt it makes a difference on 2.6 kernel (i386) cause it works on
amd64. Here is the fresh build with your test file.
apr-1.2.2
tomcat-native-1.1.1
apache-tomcat-5.5.15
OpenSSL 0.9.7a (part of distro)

[mturk@dev03 bin]$ uname -a
Linux 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55 EDT 2005 i686 i686 i386 GNU/Linux

[mturk@dev03 bin]$ wget http://localhost:9080/t2.bin
--11:40:02--  http://localhost:9080/t2.bin
           => `t2.bin'
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:9080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 38,144 (37K) [application/octet-stream]

100%[========================================================================================>]
38,144        --.--K/s

11:40:03 (94.00 MB/s) - `t2.bin' saved [38144/38144]

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From psamek@redash.cz  2006-02-02 16:20 -------
(In reply to comment #5)
> The first one doesn't know what he's talking about, the second one is using a
> build which has a buffering bug in some cases, while I will ignore the third one
> (that's you) since he didn't read our replies.
> 
I have read your replies (although a reply in the sense of "it works for me,
don't bother" is not much constructive). Maybe the buffering bug is not
completely solved in 5.5.15, I don't know. 
Anyway if you have some hint (what to test, configure) I would be also very
grateful.
(BTW: The compression seems to be a workaround only for usual files. For bigger
files output is corrupted or not complete again.)

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From remm@apache.org  2006-02-02 16:48 -------
(In reply to comment #6)
> Of course I'm interested - and even more so since I'm obviously not the only one
> having problems with the APR Connector.
> And yes, my testcase ist absolutely trivial. That's because it's trivial for me
> to trigger the error. For me, what's not trivial but extremely hard, is to set
> up a linux system where this simple file gets served without errors.

You can try to look at what would make your configuration/usage different. Ex:
running as root or not, TCP parameters, etc.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-02-06 13:26 -------
(In reply to comment #8)
> You can try to look at what would make your configuration/usage different. Ex:
> running as root or not, TCP parameters, etc.

Neither does the account Tomcat is running under make any difference nor have I
set any TCP parameters, I'm simply using the defaults.

I'm not sure how I managed to miss the following point: the download of the
binary file works without problems for me, if the client runs on the same
machine as Tomcat. Downloading from a different machine results in a corrupted
file - as initially reported. I'm sorry for this omitment.
Mladen, could you please check if it still works for you when you download the
file from a different machine?

Remote or not - the listing of the directory with many files is always somehow
garbled for me. To simulate this I'll attach a JSP that creates a HTML table
with many rows (1000 by default, cofigurable via the "rows" request parameter).
Depending on the number of rows actually requested, most of the time the
document differs in one way or another from what is to be expected. This ranges
from a <tr> not correctly closed somewhere in the middle of the document to only
part of it being actually transmitted.
It would be nice if you could check this too.

I thought the NPTL-enabled libc on my system might have something to do with the
problem. So I started Tomcat using a libc using LinuxThreads - no difference.
I've even set up a complete system with kernel 2.4.31 (and a libc with
LinuxThreads obviously) but the behaviour was the same - local download works,
remote doesn't.

After all, I have still not been able to set up a systen on which the APR
Connector works reliabaly. I start to get desperate.


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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


remm@apache.org changed:

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




------- Additional Comments From remm@apache.org  2006-02-07 13:06 -------
Yes, the APR API seems more closely related to java.nio, but I am too used to
java.io. Since I don't want to compromise usage of the API in non blocking
situations, it is probably better to do the loop in Java.

The Java patch applied is (hopefully it's correct, please test it):

Modified:
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
URL:
http://svn.apache.org/viewcvs/tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java?rev=375582&r1=375581&r2=375582&view=diff
==============================================================================
---
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
(original)
+++
tomcat/connectors/trunk/http11/src/java/org/apache/coyote/http11/InternalAprOutputBuffer.java
Tue Feb  7 03:47:20 2006
@@ -695,9 +695,14 @@
     protected void flushBuffer()
         throws IOException {
         if (bbuf.position() > 0) {
-            if (Socket.sendbb(socket, 0, bbuf.position()) < 0) {
-                throw new IOException(sm.getString("iib.failedwrite"));
-            }
+            int i = 0;
+            int n = 0;
+            do {
+                if ((n = Socket.sendbb(socket, i, bbuf.position())) < 0) {
+                    throw new IOException();
+                }
+                i += n;
+            } while (i < bbuf.position());
             bbuf.clear();
         }
     }



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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From remm@apache.org  2006-01-31 18:08 -------
Another user reported the same thing with about any resource (JSPs, files), but
his report was bad. I cannot reproduce this (advice: if the test case seems too
trivial, then there's something wrong with the report), so you'll have to
investigate yourself if you are interested.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-02-07 18:18 -------
Mladen, R�my, thanks for the good work!

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464





------- Additional Comments From bugzilla@schoenhaber.de  2006-02-02 15:07 -------
(In reply to comment #3)
> Another user reported the same thing with about any resource (JSPs, files), but
> his report was bad. I cannot reproduce this (advice: if the test case seems too
> trivial, then there's something wrong with the report), so you'll have to
> investigate yourself if you are interested.

(In reply to comment #3)
> Another user reported the same thing with about any resource (JSPs, files), but
> his report was bad. I cannot reproduce this (advice: if the test case seems too
> trivial, then there's something wrong with the report), so you'll have to
> investigate yourself if you are interested.

Of course I'm interested - and even more so since I'm obviously not the only one
having problems with the APR Connector.
And yes, my testcase ist absolutely trivial. That's because it's trivial for me
to trigger the error. For me, what's not trivial but extremely hard, is to set
up a linux system where this simple file gets served without errors. I have yet
to succeed in this task.
I'm not very experienced in debugging tomcat and even less when it comes to
debugging JNI parts. So, comparing a system that shows the error with one that
doesn't seems to me a reasonable first try.
If you have any other hints on what to do to get this tracked down, I'd be grateful.



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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


remm@apache.org changed:

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




------- Additional Comments From remm@apache.org  2006-02-07 15:32 -------
(In reply to comment #15)
> (In reply to comment #14)
> > The Java patch applied is (hopefully it's correct, please test it):
> 
> No, doesn't work for me. The table.jsp gets corrupted. (It does work when a
> tcnative with Mladen's patch is used - but that's beside the point, isn't it?)

I do not find this convincing.

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

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


DO NOT REPLY [Bug 38464] - Data corruption when using APR

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38464


psamek@redash.cz changed:

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




------- Additional Comments From psamek@redash.cz  2006-02-02 14:29 -------
When APR and compression="off" are used I will get only:
- 16Kb (yes 16384B) output from jsp on AMD64 (2xOpteron, Sun JDK
1.5.0.06,APR 1.2.2,tomcat-native-1.1.1 from the 5.5.15 distribution, gcc
3.4.4, StockTomcat 5.5.15)
- 64Kb output from jsp on Intel P4 (Sun JDK 1.5.0.06,APR
1.2.2,tomcat-native-1.1.1 from the 5.5.15 distribution, gcc 3.4.4,
StockTomcat 5.5.15).
These sizes are reported by firefox 1.5. If I use wget, then the output
seems complete (goes beyond 64Kb), but some corruptions take place (f.e.
"</psp;" instead of "</p>&nbsp;"). The jsp gets some data from MySQL db.

Binary data (.mp3) and static text/plain are OK, but static html or xml not.
With wget and html I have similar reconnecting behavior like described
in the initial report. The simple test - serving only static web.xml from tomcat
distribution - looks so with wget:
pavel$ wget http://myserver.cz:8080/web.xml
--14:23:41--  http://myserver.cz:8080/web.xml
           => `web.xml'
Resolving myserver.cz... x.x.x.x
Connecting to myserver.cz|x.x.x.x|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45,215 (44K) [application/xml]

78% [===========================>         ] 35,279        --.--K/s    ETA 00:05

14:24:02 (1.64 KB/s) - Connection closed at byte 35279. Retrying.

--14:24:02--  http://myserver.cz:8080/web.xml
  (try: 2) => `web.xml'
Connecting to myserver.cz|x.x.x.x|:8080... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 45,215 (44K), 9,936 (9.7K) remaining [application/xml]

100%[++++++++++++++++++++++++++++========>] 45,215        --.--K/s             

14:24:02 (13.12 MB/s) - `web.xml' saved [45215/45215]


In the case of APR and compression="on" the .jsp are OK (but the
reported size is far below the above limits, so I can't say if it works
in general).

Maybe I have to "set some option" in server.xml or in configure for apr, but
which one???

Similar output has been reported: [1],[2]
[1] http://marc.theaimsgroup.com/?l=tomcat-user&m=113711225801348&w=2
[2] http://marc.theaimsgroup.com/?l=tomcat-user&m=113819615811780&w=2


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

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