You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Kočí (JIRA)" <de...@myfaces.apache.org> on 2012/05/10 20:56:49 UTC
[jira] [Created] (MYFACES-3545) FACELETS_REFRESH_PERIOD > 0 +
.xhtml in .jar = Too many open files
Martin Kočí created MYFACES-3545:
------------------------------------
Summary: FACELETS_REFRESH_PERIOD > 0 + .xhtml in .jar = Too many open files
Key: MYFACES-3545
URL: https://issues.apache.org/jira/browse/MYFACES-3545
Project: MyFaces Core
Issue Type: Bug
Components: General
Affects Versions: 2.1.7
Environment: myfaces trunk
Reporter: Martin Kočí
Assignee: Martin Kočí
this is a classic one:
https://issues.apache.org/jira/browse/TRINIDAD-73
https://issues.apache.org/jira/browse/MYFACES-1982
>From http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg20937.html:
" .... It's a bug in Sun's JarURLConnection. The workaround should solve the problems even in
development mode.
When you open an URL connection to an entry in a jar, you get a
JarURLConnection. The JarURLConnection in the package
sun.net.www.protocol.jar has an internal field
/* the url connection for the JAR file */
private URLConnection jarFileURLConnection;
which you cannot access in any way. When you ask for the last modified
time, the JarURLConnection will ask for the header field
"last-modified", which in turn will ask the jarFileURLConnection for the
that header field, which in turn will cause the initializeHeaders() call
in FileURLConnection, which in turn calls connect() and opens the file
(even though for the last modified header that is quite unnecessary).
The way to close the file is to call getInputStream().close() on the
jarFileURLConnection field, but unfortunately you can't since it is hidden.
There is a very simple workaround though. In code:
URL url = new URL("jar:file:jarfile.jar!Entry.class");
URLConnection connection = url.openConnection();
if (connection instanceof JarURLConnection) {
JarURLConnection jarUrlConnection = (JarURLConnection)
connection;
URL jarFileUrl = jarUrlConnection.getJarFileURL();
URLConnection jarFileConnection =
jarFileUrl.openConnection();
long lastModified = jarFileConnection.getLastModified();
jarFileConnection.getInputStream().close();
System.out.println("last modified=" + new
Date(lastModified));
}
... "
This little hack is not done in myfaces DefaultFaceletFactory and FaceletCacheImpl.
Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development stage
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MYFACES-3545) FACELETS_REFRESH_PERIOD > 0 +
.xhtml in .jar = Too many open files
Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Leonardo Uribe updated MYFACES-3545:
------------------------------------
Resolution: Fixed
Fix Version/s: 2.1.8
2.0.14
Status: Resolved (was: Patch Available)
Thanks to Martin Koci for provide this patch
> FACELETS_REFRESH_PERIOD > 0 + .xhtml in .jar = Too many open files
> -------------------------------------------------------------------
>
> Key: MYFACES-3545
> URL: https://issues.apache.org/jira/browse/MYFACES-3545
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.7
> Environment: myfaces trunk
> Reporter: Martin Kočí
> Assignee: Martin Kočí
> Fix For: 2.0.14, 2.1.8
>
> Attachments: MYFACES-3545.patch
>
>
> this is a classic one:
> https://issues.apache.org/jira/browse/TRINIDAD-73
> https://issues.apache.org/jira/browse/MYFACES-1982
> From http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg20937.html:
> " .... It's a bug in Sun's JarURLConnection. The workaround should solve the problems even in
> development mode.
> When you open an URL connection to an entry in a jar, you get a
> JarURLConnection. The JarURLConnection in the package
> sun.net.www.protocol.jar has an internal field
> /* the url connection for the JAR file */
> private URLConnection jarFileURLConnection;
> which you cannot access in any way. When you ask for the last modified
> time, the JarURLConnection will ask for the header field
> "last-modified", which in turn will ask the jarFileURLConnection for the
> that header field, which in turn will cause the initializeHeaders() call
> in FileURLConnection, which in turn calls connect() and opens the file
> (even though for the last modified header that is quite unnecessary).
> The way to close the file is to call getInputStream().close() on the
> jarFileURLConnection field, but unfortunately you can't since it is hidden.
> There is a very simple workaround though. In code:
> URL url = new URL("jar:file:jarfile.jar!Entry.class");
> URLConnection connection = url.openConnection();
> if (connection instanceof JarURLConnection) {
> JarURLConnection jarUrlConnection = (JarURLConnection)
> connection;
> URL jarFileUrl = jarUrlConnection.getJarFileURL();
> URLConnection jarFileConnection =
> jarFileUrl.openConnection();
> long lastModified = jarFileConnection.getLastModified();
> jarFileConnection.getInputStream().close();
> System.out.println("last modified=" + new
> Date(lastModified));
> }
> ... "
> This little hack is not done in myfaces DefaultFaceletFactory and FaceletCacheImpl.
> Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development stage
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (MYFACES-3545) FACELETS_REFRESH_PERIOD > 0 +
.xhtml in .jar = Too many open files
Posted by "Martin Kočí (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Kočí updated MYFACES-3545:
---------------------------------
Status: Patch Available (was: Open)
> FACELETS_REFRESH_PERIOD > 0 + .xhtml in .jar = Too many open files
> -------------------------------------------------------------------
>
> Key: MYFACES-3545
> URL: https://issues.apache.org/jira/browse/MYFACES-3545
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.7
> Environment: myfaces trunk
> Reporter: Martin Kočí
> Assignee: Martin Kočí
> Attachments: MYFACES-3545.patch
>
>
> this is a classic one:
> https://issues.apache.org/jira/browse/TRINIDAD-73
> https://issues.apache.org/jira/browse/MYFACES-1982
> From http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg20937.html:
> " .... It's a bug in Sun's JarURLConnection. The workaround should solve the problems even in
> development mode.
> When you open an URL connection to an entry in a jar, you get a
> JarURLConnection. The JarURLConnection in the package
> sun.net.www.protocol.jar has an internal field
> /* the url connection for the JAR file */
> private URLConnection jarFileURLConnection;
> which you cannot access in any way. When you ask for the last modified
> time, the JarURLConnection will ask for the header field
> "last-modified", which in turn will ask the jarFileURLConnection for the
> that header field, which in turn will cause the initializeHeaders() call
> in FileURLConnection, which in turn calls connect() and opens the file
> (even though for the last modified header that is quite unnecessary).
> The way to close the file is to call getInputStream().close() on the
> jarFileURLConnection field, but unfortunately you can't since it is hidden.
> There is a very simple workaround though. In code:
> URL url = new URL("jar:file:jarfile.jar!Entry.class");
> URLConnection connection = url.openConnection();
> if (connection instanceof JarURLConnection) {
> JarURLConnection jarUrlConnection = (JarURLConnection)
> connection;
> URL jarFileUrl = jarUrlConnection.getJarFileURL();
> URLConnection jarFileConnection =
> jarFileUrl.openConnection();
> long lastModified = jarFileConnection.getLastModified();
> jarFileConnection.getInputStream().close();
> System.out.println("last modified=" + new
> Date(lastModified));
> }
> ... "
> This little hack is not done in myfaces DefaultFaceletFactory and FaceletCacheImpl.
> Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development stage
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MYFACES-3545) FACELETS_REFRESH_PERIOD > 0 +
.xhtml in .jar = Too many open files
Posted by "Mark Struberg (JIRA)" <de...@myfaces.apache.org>.
[ https://issues.apache.org/jira/browse/MYFACES-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13272663#comment-13272663 ]
Mark Struberg commented on MYFACES-3545:
----------------------------------------
Martin, if you are using tomcat, can you please try the following:
create a file META-INF/context.xml and add the following content:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" />
{code}
This helped us a lot.
> FACELETS_REFRESH_PERIOD > 0 + .xhtml in .jar = Too many open files
> -------------------------------------------------------------------
>
> Key: MYFACES-3545
> URL: https://issues.apache.org/jira/browse/MYFACES-3545
> Project: MyFaces Core
> Issue Type: Bug
> Components: General
> Affects Versions: 2.1.7
> Environment: myfaces trunk
> Reporter: Martin Kočí
> Assignee: Martin Kočí
> Attachments: MYFACES-3545.patch
>
>
> this is a classic one:
> https://issues.apache.org/jira/browse/TRINIDAD-73
> https://issues.apache.org/jira/browse/MYFACES-1982
> From http://www.mail-archive.com/wicket-user@lists.sourceforge.net/msg20937.html:
> " .... It's a bug in Sun's JarURLConnection. The workaround should solve the problems even in
> development mode.
> When you open an URL connection to an entry in a jar, you get a
> JarURLConnection. The JarURLConnection in the package
> sun.net.www.protocol.jar has an internal field
> /* the url connection for the JAR file */
> private URLConnection jarFileURLConnection;
> which you cannot access in any way. When you ask for the last modified
> time, the JarURLConnection will ask for the header field
> "last-modified", which in turn will ask the jarFileURLConnection for the
> that header field, which in turn will cause the initializeHeaders() call
> in FileURLConnection, which in turn calls connect() and opens the file
> (even though for the last modified header that is quite unnecessary).
> The way to close the file is to call getInputStream().close() on the
> jarFileURLConnection field, but unfortunately you can't since it is hidden.
> There is a very simple workaround though. In code:
> URL url = new URL("jar:file:jarfile.jar!Entry.class");
> URLConnection connection = url.openConnection();
> if (connection instanceof JarURLConnection) {
> JarURLConnection jarUrlConnection = (JarURLConnection)
> connection;
> URL jarFileUrl = jarUrlConnection.getJarFileURL();
> URLConnection jarFileConnection =
> jarFileUrl.openConnection();
> long lastModified = jarFileConnection.getLastModified();
> jarFileConnection.getInputStream().close();
> System.out.println("last modified=" + new
> Date(lastModified));
> }
> ... "
> This little hack is not done in myfaces DefaultFaceletFactory and FaceletCacheImpl.
> Simple workaround is: javax.faces.FACELETS_REFRESH_PERIOD=0 in Development stage
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira