{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/22552","repository_url":"https://api.github.com/repos/eclipse-ee4j/glassfish","labels_url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/22552/labels{/name}","comments_url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/22552/comments","events_url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/22552/events","html_url":"https://github.com/eclipse-ee4j/glassfish/issues/22552","id":361042761,"node_id":"MDU6SXNzdWUzNjEwNDI3NjE=","number":22552,"title":"IOException (\"Stream closed\") has occurred when accessing two different apps at the same time","user":{"login":"glassfishrobot","id":6104758,"node_id":"MDQ6VXNlcjYxMDQ3NTg=","avatar_url":"https://avatars0.githubusercontent.com/u/6104758?v=4","gravatar_id":"","url":"https://api.github.com/users/glassfishrobot","html_url":"https://github.com/glassfishrobot","followers_url":"https://api.github.com/users/glassfishrobot/followers","following_url":"https://api.github.com/users/glassfishrobot/following{/other_user}","gists_url":"https://api.github.com/users/glassfishrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/glassfishrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glassfishrobot/subscriptions","organizations_url":"https://api.github.com/users/glassfishrobot/orgs","repos_url":"https://api.github.com/users/glassfishrobot/repos","events_url":"https://api.github.com/users/glassfishrobot/events{/privacy}","received_events_url":"https://api.github.com/users/glassfishrobot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-18T09:20:16Z","updated_at":"2018-11-09T05:50:50Z","closed_at":null,"author_association":"NONE","body":"[//]: # \"Please remove these comments\"\r\n[//]: # \"Provide a general summary of the issue in the Title above\"\r\n\r\n\r\n## Environment Details\r\n* GlassFish Version (and build number): 4.1\r\n* JDK version: 1.7\r\n* OS: win 7\r\n* Database: none\r\n\r\n----------\r\n\r\n## Problem Description\r\nJSP compiling process is done at the first access. at this time,\r\nI debug following the operating steps, IOException (\"Stream closed\") has occurred.\r\nit occur in the debug, but I think it will occur in high concurrent accessing apps.\r\nIs it a bug of Glassfish, since two threads get the same jarFile.\r\n\r\n\r\n## Steps to reproduce\r\n1.Deploy test app1 and app2 and start cluster.\r\n2.Set breakpoints\r\n```\r\norg.apache.jasper.runtime.TldScanner.scanJar(TldScanner.java:447)  Set a breakpoint here\r\n   private void scanJar(JarURLConnection conn, List<String> tldNames,boolean isLocal) throws JasperException {\r\n\t...                        \r\n\ttry {\r\n\t\tjarFile = conn.getJarFile();\r\n\t\tif (tldNames != null) {\r\n\t\t\tfor (String tldName : tldNames) {\r\n\t\t\t\tJarEntry entry = jarFile.getJarEntry(tldName);\r\n\t\t\t\tInputStream stream = jarFile.getInputStream(entry);\r\n\t\t\t\ttldInfoA.add(scanTld(resourcePath, tldName, stream)); ★\r\n```\r\n\r\n3.access app1 and app2.\r\n4.At this time, two threads stop at the breakpoint.\r\n5.First, resume the thread of app1. Leave the thread of app 2 stopped at the breakpoint.\r\n6.When executing the thread of app 2, IOException (\"Stream closed\") is output because ★closed value is set to true.\r\n\r\n## Impact of Issue\r\nThe following log is reported and the second app return '500'\r\n\r\n[#|2018-07-12T02:56:08.230-0700|WARNING|||_ThreadID=67;_ThreadName=http-thread-pool-28292(2);|ApplicationDispatcher[/Demo2] PWC1231: Servlet.service() for servlet jsp threw exception\r\njava.io.IOException: Stream closed\r\n         at java.util.zip.InflaterInputStream.ensureOpen(InflaterInputStream.java:67)\r\n         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:121)\r\n         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2873)\r\n         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:664)\r\n         at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)\r\n         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:812)\r\n         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)\r\n         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)\r\n         at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)\r\n         at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)\r\n         at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:298)\r\n         at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:368)\r\n         at org.apache.jasper.runtime.TldScanner.scanTld(TldScanner.java:600)\r\n         at org.apache.jasper.runtime.TldScanner.scanJar(TldScanner.java:447)\r\n         at org.apache.jasper.runtime.TldScanner.scanJars(TldScanner.java:737)\r\n         at org.apache.jasper.runtime.TldScanner.scanTlds(TldScanner.java:350)\r\n         at org.apache.jasper.runtime.TldScanner.getLocation(TldScanner.java:283)\r\n         at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:589)\r\n         at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:500)\r\n         at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:582)\r\n         at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1652)\r\n         at org.apache.jasper.compiler.Parser.parse(Parser.java:185)\r\n         at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)\r\n         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:145)\r\n         at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:212)\r\n         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)\r\n         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:627)\r\n         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)\r\n         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)\r\n         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)\r\n         at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)\r\n         at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)\r\n         at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:809)\r\n         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)\r\n         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:505)\r\n         at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:476)\r\n         at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:355)\r\n         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:305)\r\n         ...\r\n         at java.lang.Thread.run(Thread.java:745)\r\n\r\n## Occurrence condition:\r\n1.At the same time when accessing app 1 and app 2 (JSP compiling process is done at first access), two processing threads (thread 1, 2) are activated, and these two threads get the same jarFile ★ 1.\r\n2.At the end of the scanJar () method of app 1 (thread 1), jarFile is closed. ★ 3.\r\n3.Since jarFile is closed, the closed state of stream★2 of app 2 (thread 2) is true.\r\n4.When app2 (thread 2) executes scanTld (), an IOException (\"Stream closed\") occurs because the closed state of stream has become true.\r\n\r\n```\r\norg.apache.jasper.runtime.TldScanner.scanJar(TldScanner.java:447)\r\n    private void scanJar(JarURLConnection conn, List<String> tldNames,boolean isLocal) throws JasperException {\r\n\t...                        \r\n\ttry {\r\n\t\tjarFile = conn.getJarFile(); ★1\r\n\t\tif (tldNames != null) {\r\n\t\t\t for (String tldName : tldNames) {\r\n\t\t\t\tJarEntry entry = jarFile.getJarEntry(tldName);\r\n\t\t\t\tInputStream stream = jarFile.getInputStream(entry);\r\n\t\t\t\ttldInfoA.add(scanTld(resourcePath, tldName, stream)); ★2\r\n\t\t\t ...               \r\n\tfinally {\r\n            \tif (jarFile != null) {\r\n\t\t\ttry {\r\n\t\t\t\tjarFile.close(); ★3\r\n\t\t\t} catch (Throwable t) {\r\n\t\t\t\t// ignore\r\n\t\t\t}\r\n\t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/comments/437257824","html_url":"https://github.com/eclipse-ee4j/glassfish/issues/22552#issuecomment-437257824","issue_url":"https://api.github.com/repos/eclipse-ee4j/glassfish/issues/22552","id":437257824,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzI1NzgyNA==","user":{"login":"micRo-wlY","id":41110036,"node_id":"MDQ6VXNlcjQxMTEwMDM2","avatar_url":"https://avatars0.githubusercontent.com/u/41110036?v=4","gravatar_id":"","url":"https://api.github.com/users/micRo-wlY","html_url":"https://github.com/micRo-wlY","followers_url":"https://api.github.com/users/micRo-wlY/followers","following_url":"https://api.github.com/users/micRo-wlY/following{/other_user}","gists_url":"https://api.github.com/users/micRo-wlY/gists{/gist_id}","starred_url":"https://api.github.com/users/micRo-wlY/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micRo-wlY/subscriptions","organizations_url":"https://api.github.com/users/micRo-wlY/orgs","repos_url":"https://api.github.com/users/micRo-wlY/repos","events_url":"https://api.github.com/users/micRo-wlY/events{/privacy}","received_events_url":"https://api.github.com/users/micRo-wlY/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T05:50:50Z","updated_at":"2018-11-09T05:50:50Z","author_association":"NONE","body":"### There are some conditions to correct\r\n\r\nThe occurrence conditions can be divided into the case of using jstl and not using jstl, specifically refer to the following:\r\n\r\nNot using jstl:\r\ncase1\r\n①The following definitions in JSP\r\n`<@taglib uri=\"demo-taglib\" prefix=\"demo\" %>`\r\nAnd,\r\n②the following taglib defined in the web.xml\r\n```\r\n<jsp-config>\r\n    <taglib>\r\n      <taglib-uri>demo-taglib</taglib-uri>\r\n      <taglib-location>/WEB-INF/demo.tld</taglib-location>\r\n    </taglib>\r\n  </jsp-config>\r\n```\r\n  \r\ncase2\r\nThe following definitions in JSP\r\n`<@taglib uri=\"WEB-INF/demo.tld\" prefix=\"demo\" %>`\r\n\r\nUsing jstl:\r\nWhen the JSP contains jstl related tags (eg <c:>)\r\n\r\n**Is there anyone who can respond as quickly as possible, thanks very much. :)**"}}
{"actor":{"display_login":"micRo-wlY"}}