On 9 March 2015 16:35:57 GMT+00:00, Christopher Schultz <ch...@christopherschultz.net> wrote: >Mark, > >On 3/9/15 12:32 PM, ma...@apache.org wrote: >> Author: markt >> Date: Mon Mar 9 16:32:43 2015 >> New Revision: 1665297 >> >> URL: http://svn.apache.org/r1665297 >> Log: >> Follow up to r1665062 >> Callers assume that output() will fully write the data that is passed >to it. Ensure that this is the case when the AJP message size is larger >than the output buffer. >> >> Modified: >> >tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java >> >> Modified: >tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java >> URL: >http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1665297&r1=1665296&r2=1665297&view=diff >> >============================================================================== >> --- >tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java >(original) >> +++ >tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java >Mon Mar 9 16:32:43 2015 >> @@ -302,24 +302,29 @@ public class AjpNioProcessor extends Abs >> ByteBuffer writeBuffer = >> >socketWrapper.getSocket().getBufHandler().getWriteBuffer(); >> >> - int toWrite = Math.min(length, writeBuffer.remaining()); >> - writeBuffer.put(src, offset, toWrite); >> - >> - writeBuffer.flip(); >> - >> - long writeTimeout = att.getWriteTimeout(); >> - Selector selector = null; >> - try { >> - selector = pool.get(); >> - } catch ( IOException x ) { >> - //ignore >> - } >> - try { >> - pool.write(writeBuffer, socketWrapper.getSocket(), >selector, >> - writeTimeout, true); >> - }finally { >> - writeBuffer.clear(); >> - if ( selector != null ) pool.put(selector); >> + int left = length; >> + int written = 0; >> + while (left > 0) { >> + int toWrite = Math.min(left, writeBuffer.remaining()); >> + writeBuffer.put(src, offset, toWrite); >> + >> + writeBuffer.flip(); >> + >> + long writeTimeout = att.getWriteTimeout(); >> + Selector selector = null; >> + try { >> + selector = pool.get(); >> + } catch ( IOException x ) { >> + //ignore >> + } >> + try { >> + written = pool.write(writeBuffer, >socketWrapper.getSocket(), >> + selector, writeTimeout, true); >> + } finally { >> + writeBuffer.clear(); >> + if ( selector != null ) pool.put(selector); >> + } >> + left -= written; >> } >> } > >Okay, yes, this was more like what I was expecting to see. I'll give it >another try.
Glad to see it is working now. The next jobs are a) documenting the expected behavior re full vs partial write and b) take a look at trying to reduce the number of array copies (or equivalent) that the I/O codes does. Mark > >Thanks! >-chris --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org