java.io.EOFException when using Multipart form-data
adrian.boangiu May 5, 2017 11:00 AMHello,
We have migrated an application developed using ADF 12.1.3 and ADF Faces based on Trinidad implementation from JBoss 7.1.1 to Wildfly 10.1.
In Wildfly 10.1 we have the following exception every time we post a form which allows multipart content:
13:02:46,630 SEVERE [org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl] (default task-59) : java.io.EOFException
at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._readLine(MultipartFormHandler.java:253) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._readLine(MultipartFormHandler.java:237) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._skipBoundary(MultipartFormHandler.java:223) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.<init>(MultipartFormHandler.java:102) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler.<init>(MultipartFormHandler.java:75) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.config.upload.FileUploadConfiguratorImpl.beginRequest(FileUploadConfiguratorImpl.java:139) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl._startConfiguratorServiceRequest(GlobalConfiguratorImpl.java:732) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl.beginRequest(GlobalConfiguratorImpl.java:227) [trinidad-impl.jar:]
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:181) [trinidad-impl.jar:]
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) [trinidad-api.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at com.siveco.jsf.server.filter.SessionFilter.doFilter(SessionFilter.java:207) [JSFServer.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at com.siveco.server.EncodingFilter.doFilter(EncodingFilter.java:45) [JSFLogin.jar:]
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.handlers.MetricsHandler.handleRequest(MetricsHandler.java:62) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.core.MetricsChainHandler.handleRequest(MetricsChainHandler.java:59) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1$1.run(ServletInitialHandler.java:110) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_92]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:107) [undertow-servlet-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805) [undertow-core-1.4.0.Final.jar:1.4.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_92]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_92]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_92]
The http request headers are in both cases (JBoss/Wildfly):
Accept | text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 |
Accept-Encoding | gzip, deflate |
Accept-Language | fr-FR,en-US;q=0.7,en;q=0.3 |
Connection | keep-alive |
Content-Length | 2729 |
Content-Type | multipart/form-data; boundary=---------------------------16200160599501 |
Cookie | JSESSIONID=ZwjjfrGzQLgRmYHYGdI4w6r43aeusR0xqjOaQHLT.siv608 |
Host | localhost:8080 |
Referer | http://localhost:8080/coswin/58393467.xhtml?maxDesktopWidth=1392&maxDesktopHeight=234 |
Upgrade-Insecure-Requests | 1 |
User-Agent | Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:53.0) Gecko/20100101 Firefox/53.0 Waterfox/53.0 |
The http request is in both cases (JBoss/Wildfly):
-----------------------------1374726183875 Content-Disposition: form-data; name="stateID" ad3f0c6 -----------------------------1374726183875 Content-Disposition: form-data; name="stateKey" 58393467 -----------------------------1374726183875 Content-Disposition: form-data; name="childrenStateID" e38acf5a -----------------------------1374726183875 Content-Disposition: form-data; name="masterRowKey" 000100000006313244444444 -----------------------------1374726183875 Content-Disposition: form-data; name="csTrState" false -----------------------------1374726183875 Content-Disposition: form-data; name="ssTrState" false -----------------------------1374726183875 Content-Disposition: form-data; name="toolbar_Table1View_searchStr" -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk19" 12DDDD -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk1b" 1223 -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk36" AAAA -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk1d" -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk1h" -----------------------------1374726183875 Content-Disposition: form-data; name="eyrk1j" -----------------------------1374726183875 Content-Disposition: form-data; name="tyrk34_autoValidateRow" false -----------------------------1374726183875 Content-Disposition: form-data; name="org.apache.myfaces.trinidad.faces.FORM" viewTable -----------------------------1374726183875 Content-Disposition: form-data; name="Adf-Window-Id" w5 -----------------------------1374726183875 Content-Disposition: form-data; name="javax.faces.ViewState" !w6pcljq68 -----------------------------1374726183875 Content-Disposition: form-data; name="action" refreshui -----------------------------1374726183875 Content-Disposition: form-data; name="iterName" Table1View -----------------------------1374726183875 Content-Disposition: form-data; name="sourceName" toolbar_Table1View_refresh_button -----------------------------1374726183875 Content-Disposition: form-data; name="oracle.adf.view.rich.DELTAS" {p0:tyrk34={viewportSize=16}} -----------------------------1374726183875 Content-Disposition: form-data; name="event" toolbar_Table1View_refresh_button -----------------------------1374726183875 Content-Disposition: form-data; name="event.toolbar_Table1View_refresh_button" <m xmlns="http://oracle.com/richClient/comm"><k v="type"><s>action</s></k></m> -----------------------------1374726183875--
The undertow subsystem is configured as follows:
<subsystem xmlns="urn:jboss:domain:undertow:3.1" statistics-enabled="true">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="apacheListener" socket-binding="ajp" scheme="http"/>
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" url-charset="utf-8" />
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<access-log pattern="%h %l %u %t (%r) %s %b %D %I" prefix="access" suffix=".log" predicate="not path-suffix(*.css)"/>
<filter-ref name="company-header"/>
<filter-ref name="404-handler" predicate="true"/>
</host>
</server>
<servlet-container name="default" allow-non-standard-wrappers="true" use-listener-encoding="true" default-encoding="utf-8">
<jsp-config x-powered-by="false"/>
<session-cookie http-only="true" secure="true"/>
<websockets/>
</servlet-container>
We have observed that at the level of the method org.apache.myfaces.trinidadinternal.share.util.MultipartFormHandler._skipBoundary:
public MultipartFormHandler(final String type, final InputStream in) throws IOException
{
if (!type.startsWith(_MULTIPART_REQUEST_TYPE))
{
throw new IllegalStateException(_LOG.getMessage(
"CONTENT_NOT_MULTIPART_FORM_DATA"));
}
_boundary = _parseBoundary(type);
_in = new BufferedInputStream(in);
_skipBoundary();
}
the InputStream in contains the full text of the http request in JBoss (and Tomcat) and is empty in Wildfly.
Can you please tell us if there is something we can do to overturn this error?
Thank you