[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-09 Thread Radim Tlusty (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17504035#comment-17504035
 ] 

Radim Tlusty edited comment on LOG4J2-3423 at 3/10/22, 6:53 AM:


[~pkarwasz] - I've successfully tested your changes. Thank you for the fix.


was (Author: JIRAUSER286039):
[~pkarwasz] - I've successfully tested you changes. Thank you for the fix.

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-09 Thread Piotr Karwasz (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17503900#comment-17503900
 ] 

Piotr Karwasz edited comment on LOG4J2-3423 at 3/9/22, 10:58 PM:
-

[~rtlusty], I generated a snapshot with the latest changes, can you test if it 
solves your issue?

Problems with JAR files can appear in two occasions:
# you explicitly use a `jar:file:` URI,
# you use a relative URI path, which points to a file on your classpath (in a 
Jar).

Both paths should be fixed now.


was (Author: pkarwasz):
[~rtlusty], I generated a snapshot with the latest changes, can you test if it 
solves your issue?

Problems with JAR files can appear in two occasions:
# you explicitly use a `jar:file:` URI,
# you use a relative URI path, which points to a file on your classpath (in a 
Jar).

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-03 Thread Piotr P. Karwasz (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17501079#comment-17501079
 ] 

Piotr P. Karwasz edited comment on LOG4J2-3423 at 3/3/22, 11:22 PM:


Undertow had the same issue (cf. 
[UNDERTOW-1338|https://issues.redhat.com/browse/UNDERTOW-1338]) and the JDK bug 
number is [JDK-6956385,|https://bugs.openjdk.java.net/browse/JDK-6956385], 
which has been open since 2010.


was (Author: JIRAUSER280472):
Undertow had the same issue (cf. 
[UNDERTOW-1338|https://issues.redhat.com/browse/UNDERTOW-1338]) and the JDK bug 
number is [JDK-6956385,|https://bugs.openjdk.java.net/browse/JDK-6956385], 
which is has been open since 2010.

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-03 Thread Ralph Goers (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17501073#comment-17501073
 ] 

Ralph Goers edited comment on LOG4J2-3423 at 3/3/22, 11:12 PM:
---

Hmm. I thought I tried to avoid using a URLConnection if it is a file. We 
should just be doing File.lastModified().

I see. FileUtils.fileFromUri() probably isn't returning a File object if it is 
inside of a jar. I'm not sure if it can. But I have a suspicion we are not 
properly closing the input streams for ConnectionSource objects when we get a 
new one.  If you get a ConfigurationSource and don't use the data in it you 
have to call getInputStream().close() when done with it.


was (Author: ralph.go...@dslextreme.com):
Hmm. I thought I tried to avoid using a URLConnection if it is a file. We 
should just be doing File.lastModified().

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-03 Thread Ralph Goers (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17501073#comment-17501073
 ] 

Ralph Goers edited comment on LOG4J2-3423 at 3/3/22, 11:15 PM:
---

Hmm. I thought I tried to avoid using a URLConnection if it is a file. We 
should just be doing File.lastModified().

I see. FileUtils.fileFromUri() probably isn't returning a File object if it is 
inside of a jar. I'm not sure if it can. But I have a suspicion we are not 
properly closing the input streams for ConnectionSource objects when we get a 
new one.  If you get a ConfigurationSource and don't use the data in it you 
have to call getInputStream().close() when done with it.

I guess I need to go through the code and make sure.


was (Author: ralph.go...@dslextreme.com):
Hmm. I thought I tried to avoid using a URLConnection if it is a file. We 
should just be doing File.lastModified().

I see. FileUtils.fileFromUri() probably isn't returning a File object if it is 
inside of a jar. I'm not sure if it can. But I have a suspicion we are not 
properly closing the input streams for ConnectionSource objects when we get a 
new one.  If you get a ConfigurationSource and don't use the data in it you 
have to call getInputStream().close() when done with it.

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-03 Thread Gary D. Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17500866#comment-17500866
 ] 

Gary D. Gregory edited comment on LOG4J2-3423 at 3/3/22, 4:48 PM:
--

Fixed in git branch {{release-2.x}} and Maven snapshot version 2.17.3 
repository [https://repository.apache.org/content/repositories/snapshots/]

[~rtlusty] Please give it a try and let us know.


was (Author: garydgregory):
Fixed in git branch {{release-2.x}} and Maven snapshot version 2.17.3 
repository https://repository.apache.org/content/repositories/snapshots/

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)


[jira] [Comment Edited] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-03 Thread Gary D. Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/LOG4J2-3423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17500693#comment-17500693
 ] 

Gary D. Gregory edited comment on LOG4J2-3423 at 3/3/22, 2:05 PM:
--

The URL connection's {{setUseCaches}} can be called with false to avoid caching 
the jar file.

I will test fixing {{org.apache.logging.log4j.core.net.UrlConnectionFactory}}...


was (Author: garydgregory):
The url connection's setUseCaches can be called with false to avoid caching the 
jar file.

> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Priority: Major
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)