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 2007/01/25 18:12:12 UTC

DO NOT REPLY [Bug 41466] New: - NIO Connector: IllegalArgumentException: You can only write using the application write buffer provided by the handler

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=41466>.
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=41466

           Summary: NIO Connector: IllegalArgumentException: You can only
                    write using the application write buffer provided by the
                    handler
           Product: Tomcat 6
           Version: 6.0.7
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: cpierret@sparus-software.com


Trying to use NIO connector instead of APR connector using Tomcat6 HEAD, I get
an IllegalArgumentException while in a call to sendAck.  

Looking at InternalNioOutputBuffer.sendAck(), it uses ByteBuffer.wrap() to
create a new ByteBuffer and uses this ByteBuffer in a call to writeToSocket.
There is a check in SecureNioChannel.write() that the ByteBuffer is the one
stored in the 

Commenting the line 372 in SecureNioChannel.java fixes the problem.
//if ( src != bufHandler.getWriteBuffer() ) throw new
IllegalArgumentException("You can only write using the application write buffer
provided by the handler.");
But I guess that the check is here for a valid reason, and a better fix would
very likely consist in fixing the sendAck or in adding an "or" condition to the
test for the case of sendAck().

GRAVE: Cannot find message associated with key standardWrapper.acknowledgeException
java.lang.IllegalArgumentException: You can only write using the application
write buffer provided by the handler.
	at org.apache.tomcat.util.net.SecureNioChannel.write(SecureNioChannel.java:372)
	at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:111)
	at
org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:434)
	at
org.apache.coyote.http11.InternalNioOutputBuffer.sendAck(InternalNioOutputBuffer.java:418)
	at org.apache.coyote.http11.Http11NioProcessor.action(Http11NioProcessor.java:1028)
	at org.apache.coyote.Response.action(Response.java:183)
	at org.apache.coyote.Response.acknowledge(Response.java:310)
	at org.apache.catalina.connector.Response.sendAcknowledgement(Response.java:1154)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:169)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
	at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:888)
	at
org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:624)
	at org.apache.tomcat.util.net.NioEndpoint$Worker.run(NioEndpoint.java:1467)
	at java.lang.Thread.run(Thread.java:595)

-- 
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 41466] - NIO Connector: IllegalArgumentException: You can only write using the application write buffer provided by the handler

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=41466>.
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=41466





------- Additional Comments From cpierret@sparus-software.com  2007-01-25 09:17 -------
Created an attachment (id=19460)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19460&action=view)
A patch fixing the issue, but not meant to be a definitive patch

Should fix this differently since it removes a useful check that is not valid
in only one special case (sendAck call)

-- 
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 41466] - NIO Connector: IllegalArgumentException: You can only write using the application write buffer provided by the handler

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=41466>.
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=41466


fhanik@apache.org changed:

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




------- Additional Comments From fhanik@apache.org  2007-01-28 13:35 -------
The following fix has been applied

Index: java/org/apache/tomcat/util/net/NioSelectorPool.java
===================================================================
--- java/org/apache/tomcat/util/net/NioSelectorPool.java        (revision 500888)
+++ java/org/apache/tomcat/util/net/NioSelectorPool.java        (working copy)
@@ -103,6 +103,10 @@
         boolean timedout = false;
         int keycount = 1; //assume we can write
         long time = System.currentTimeMillis(); //start the timeout timer
+        if ( socket.getBufHandler().getWriteBuffer()!= buf ) {
+            socket.getBufHandler().getWriteBuffer().put(buf);
+            buf = socket.getBufHandler().getWriteBuffer();
+        }
         try {
             while ( (!timedout) && buf.hasRemaining() ) {
                 if ( keycount > 0 ) { //only write if we were registered for a
write


-- 
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 41466] - NIO Connector: IllegalArgumentException: You can only write using the application write buffer provided by the handler

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=41466>.
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=41466


fhanik@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From fhanik@apache.org  2007-01-28 13:28 -------
Patch is invalid and would lead to invalid SSL data being sent, bug is
acknowledged and will be fixed.

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