[jboss-jira] [JBoss JIRA] (WFLY-4561) Servlet Nonblocking I/O Suppressed InputStream Closed Error
Mark S (JIRA)
issues at jboss.org
Mon Apr 27 11:27:52 EDT 2015
[ https://issues.jboss.org/browse/WFLY-4561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark S updated WFLY-4561:
-------------------------
Attachment: AsyncIOServletTest.java
> Servlet Nonblocking I/O Suppressed InputStream Closed Error
> -----------------------------------------------------------
>
> Key: WFLY-4561
> URL: https://issues.jboss.org/browse/WFLY-4561
> Project: WildFly
> Issue Type: Feature Request
> Components: Web (Undertow)
> Affects Versions: 8.2.0.Final
> Reporter: Mark S
> Assignee: Stuart Douglas
> Attachments: AsyncIOServletTest.java
>
>
> Created a Nonblocking I/O Servlet by following JEE Tutorial example here:
> https://docs.oracle.com/javaee/7/tutorial/servlets013.htm
> Due to my Eclipse Development Environment giving me the warning "Potential resource leak: 'input' may not be closed", I made a mistake by wrapping the following line with a try-with-resources statement.
> {code}
> final ServletInputStream input = request.getInputStream();
> {code}
> Unfortunately, no exception was thrown to indicate that the connection was already closed before processing was attempted, where I believe there should have been.
> --
> I have added the relevant source code to reproduce my situation. Please see attached code.
> In the attached source, I added an AsyncListener to monitor the life cycle.
> The handleRequestAsPerJeeTutorialWithInputStreamIssue method will give the following output:
> {code}
> 2015-04-27 10:57:20,337 (INFO ) [] AsyncIOServletTest(37): doPost(..)
> 2015-04-27 10:57:50,345 (INFO ) [] AsyncIOServletTest$1(55): onTimeout called: javax.servlet.AsyncEvent at 24865a17
> 2015-04-27 10:57:50,359 (INFO ) [] AsyncIOServletTest$1(48): onComplete called: javax.servlet.AsyncEvent at 54ff11f3
> {code}
> The handleRequestAsPerJeeTutorial method will give the following output:
> {code}
> 2015-04-27 10:56:32,111 (INFO ) [] AsyncIOServletTest(37): doPost(..)
> 2015-04-27 10:56:32,114 (INFO ) [] AsyncIOServletTest(84): handleRequestAsPerJeeTutorial(..)
> 2015-04-27 10:56:32,121 (INFO ) [] AsyncIOServletTest$2(97): onDataAvailable()
> 2015-04-27 10:56:32,121 (INFO ) [] AsyncIOServletTest$2(115): onAllDataRead()
> 2015-04-27 10:56:32,125 (INFO ) [] AsyncIOServletTest$1(48): onComplete called: javax.servlet.AsyncEvent at 3746c9ed
> {code}
> ----
> It is my opinion that a closed InputStream should cause an exception of some sort. And in this case at minimum, I think that the AsyncListener's onError should be called.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
More information about the jboss-jira
mailing list