On 09/10/17 15:51, Sergey Mashkov wrote: > Hi > > Could anybody explain me why UpgradedServletInputStream does fail with > EOFException in non-blocking mode instead of returning -1 ?
I'm not sure why an EOFException is happening. My guess is multiple calls to read() without calling isReady() between them. Once an InputStream is in non-blocking mode, every call to read() should be preceded by a call to isReady(). Only if isReady() returns true should there be a read. If isReady() returns false you need to wait for onDataAvailable() or onAllDataRead(). If you try reading before onDataAvailable() fires you should see an ISE. > Where can I > find exact Servlet API specification about this async API behaviour? Section 3.7 of the Servlet spec + the relevant Javadoc. It is also possible some of the fine detail was discussed on the EG mailing list. Mark > > java.io.EOFException > at > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1159) > at > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1130) > at > org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1067) > at > org.apache.coyote.http11.upgrade.UpgradeServletInputStream.read(UpgradeServletInputStream.java:150) > at java.io.InputStream.read(InputStream.java:101) > at io.ktor.servlet.Reader.loop(ServletReader.kt:38) > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org