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 2012/02/25 15:47:46 UTC

DO NOT REPLY [Bug 52768] New: Potential Bug or Inconsistency in AprEndpoint.java and JIoEndpoint.java

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

             Bug #: 52768
           Summary: Potential Bug or Inconsistency in AprEndpoint.java and
                    JIoEndpoint.java
           Product: Tomcat 7
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: msrbugzilla@gmail.com
    Classification: Unclassified


This is Ken Cheung, a Computer Science M.Phil. student. I observed some
code clones in Tomcat and found inconsistent code:

/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

1048                    try {
1049                        Thread.sleep(1000);
1050                    } catch (InterruptedException e) {
1051                        // Ignore
1052                    }
1053                    long now = System.currentTimeMillis();
1054                    Iterator<SocketWrapper<Long>> sockets =
1055                        waitingRequests.iterator();
1056                    while (sockets.hasNext()) {
1057                        SocketWrapper<Long> socket = sockets.next();
1058                        if (socket.async) {
1059                            long access = socket.getLastAccess();
1060                            if (socket.getTimeout() > 0 &&
1061                                    (now-access)>socket.getTimeout()) {
1062                               
processSocketAsync(socket,SocketStatus.TIMEOUT);
1063                            }
1064                        }
1065                    }

/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java

147                    try {
148                        Thread.sleep(1000);
149                    } catch (InterruptedException e) {
150                        // Ignore
151                    }
152                    long now = System.currentTimeMillis();
153                    Iterator<SocketWrapper<Socket>> sockets =
154                        waitingRequests.iterator();
155                    while (sockets.hasNext()) {
156                        SocketWrapper<Socket> socket = sockets.next();
157                        long access = socket.getLastAccess();
158                        if (socket.getTimeout() > 0 &&
159                                (now-access)>socket.getTimeout()) {
160                            processSocketAsync(socket,SocketStatus.TIMEOUT);
161                        }
162                    }

Quick description of the inconsistency
Two code snippets are very similar code, but as you see, in JIoEndpoint.java
does not check "if (socket.async)" while AprEndpoint.java has the checker.

We thought it could be a potential bug or inconsistency. Hope this helps.

-- 
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 52768] Potential Bug or Inconsistency in AprEndpoint.java and JIoEndpoint.java

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

Mark Thomas <ma...@apache.org> changed:

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

--- Comment #1 from Mark Thomas <ma...@apache.org> 2012-02-25 23:35:15 UTC ---
(In reply to comment #0)
> We thought it could be a potential bug or inconsistency. Hope this helps.

Bugzilla is not for reporting "potential bugs". If you aren't 100% sure you are
reporting a bug you shouldn't be going anywhere near Bugzilla. Just because you
don't understand something, that does not make it a bug.

If there is a part of the Tomcat source code you don't understand, the users
list (not the developers list) is the place to seek clarification.

There is no bug here. If you want an explanation of why, the users list is the
place to ask.

-- 
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