And all use of mark() should be removed through the entire codebase... but thats a second step.
On Wed, Mar 20, 2019 at 10:30 AM Jonathan Valliere <john...@apache.org> wrote: > The offending code is in AbstractPollingIoProcessor. Are you agreeing > that AbstractPollingIoProcessor has no place modifying the buffer > positions? Removing buf.reset() would probably fix the problem. > > > https://gitbox.apache.org/repos/asf?p=mina.git;a=commitdiff;h=44b58469f84ce991074cdc187b1c1f23b94cf445;hp=a42871a778c772b52267ef5a68d72cc043aaef54 > > > On Wed, Mar 20, 2019 at 10:26 AM Emmanuel Lécharny <elecha...@gmail.com> > wrote: > >> (replying to the mailing list) >> >> On 20/03/2019 15:11, Jonathan Valliere wrote: >> > And mina is calling reset() bad combo. Why would mina ever need to >> > modify the position? Just keep on writing the buffer as-is until >> flushed? >> >> It should. Any filter taking a IoBuffer as an input should *never* >> modify it. It could replace it, but not reset/flip/whatever. >> >> I suspect there is some attempt to avoid creating a new buffer at some >> point, for performance reasons. We shoudl review all the filters to >> check that they are not doing such a thing... >> >> > >> > On Wed, Mar 20, 2019 at 10:01 AM Emmanuel Lécharny >> > <elecha...@gmail.com <mailto:elecha...@gmail.com>> wrote: >> > >> > >> > On 20/03/2019 14:02, Jonathan Valliere wrote: >> > > Nothing in Mina should use the mark/reset functionality because >> > it does not >> > > compound and the unknown addition of filters create edge cases >> > where it is >> > > compounded. Should manually grab he position and manually >> > revert the >> > > position when necessary. >> > >> > >> > The zlib class is flipping the buffer, that may be the cause of >> > this issue. >> > >> > public IoBuffer deflate(IoBuffer inBuffer) throws IOException { >> > if (mode == MODE_INFLATER) { >> > throw new IllegalStateException("not initialized as >> > DEFLATER"); >> > } >> > >> > byte[] inBytes = new byte[inBuffer.remaining()]; >> > inBuffer.get(inBytes).flip(); >> > >> >