Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not use virtual threads when a SecurityManager is set #821

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sdusart
Copy link

@sdusart sdusart commented Jun 12, 2024

When running with a SecurityManager set, virtual threads have no permissions (https://openjdk.org/jeps/444).

=> Virtual threads must not be used otherwise AccessControlExceptions will be raised during file manipulations.

09:50:57,825 |-ERROR in c.q.l.core.rolling.TimeBasedRollingPolicy@1645547422 - Unexpected exception while waiting for compression job to finish java.util.concurrent.ExecutionException: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
at java.util.concurrent.ExecutionException: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
at at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
at at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.waitForAsynchronousJobToStop(TimeBasedRollingPolicy.java:140)
at at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.stop(TimeBasedRollingPolicy.java:132)
at at ch.qos.logback.core.rolling.RollingFileAppender.stop(RollingFileAppender.java:159)
at at ch.qos.logback.core.spi.AppenderAttachableImpl.detachAndStopAllAppenders(AppenderAttachableImpl.java:107)
at at ch.qos.logback.classic.Logger.detachAndStopAllAppenders(Logger.java:209)
at at ch.qos.logback.classic.Logger.recursiveReset(Logger.java:333)
at at ch.qos.logback.classic.Logger.recursiveReset(Logger.java:340)
at at ch.qos.logback.classic.LoggerContext.reset(LoggerContext.java:363)
at at ch.qos.logback.classic.LoggerContext.stop(LoggerContext.java:343)
at at org.springframework.boot.logging.logback.LogbackLoggingSystem.lambda$getShutdownHandler$2(LogbackLoggingSystem.java:391)
at at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:116)
at at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
at at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:488)
at at java.base/java.security.AccessController.checkPermission(AccessController.java:1071)
at at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
at at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:742)
at at java.base/java.io.File.exists(File.java:831)
at at ch.qos.logback.core.rolling.helper.Compressor.gzCompress(Compressor.java:148)
at at ch.qos.logback.core.rolling.helper.Compressor.compress(Compressor.java:57)
at at ch.qos.logback.core.rolling.helper.Compressor$CompressionRunnable.run(Compressor.java:246)
at at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)

@sdusart sdusart force-pushed the jdk21_with_security_manager branch from a3f5684 to 2f54d93 Compare June 12, 2024 14:29
@sdusart sdusart force-pushed the jdk21_with_security_manager branch from 2f54d93 to f889f6a Compare September 19, 2024 12:37
@sdusart sdusart force-pushed the jdk21_with_security_manager branch from f889f6a to 5578bed Compare October 24, 2024 14:16
When running with a SecurityManager set, virtual threads have no permissions (https://openjdk.org/jeps/444).
=> Virtual threads must not be used otherwise AccessControlExceptions will be raised during file manipulations.

09:50:57,825 |-ERROR in c.q.l.core.rolling.TimeBasedRollingPolicy@1645547422 - Unexpected exception while waiting for compression job to finish java.util.concurrent.ExecutionException: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
        at java.util.concurrent.ExecutionException: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
        at      at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at      at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
        at      at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.waitForAsynchronousJobToStop(TimeBasedRollingPolicy.java:140)
        at      at ch.qos.logback.core.rolling.TimeBasedRollingPolicy.stop(TimeBasedRollingPolicy.java:132)
        at      at ch.qos.logback.core.rolling.RollingFileAppender.stop(RollingFileAppender.java:159)
        at      at ch.qos.logback.core.spi.AppenderAttachableImpl.detachAndStopAllAppenders(AppenderAttachableImpl.java:107)
        at      at ch.qos.logback.classic.Logger.detachAndStopAllAppenders(Logger.java:209)
        at      at ch.qos.logback.classic.Logger.recursiveReset(Logger.java:333)
        at      at ch.qos.logback.classic.Logger.recursiveReset(Logger.java:340)
        at      at ch.qos.logback.classic.LoggerContext.reset(LoggerContext.java:363)
        at      at ch.qos.logback.classic.LoggerContext.stop(LoggerContext.java:343)
        at      at org.springframework.boot.logging.logback.LogbackLoggingSystem.lambda$getShutdownHandler$2(LogbackLoggingSystem.java:391)
        at      at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at      at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:116)
        at      at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "/path/to/logs/business.2024-06-12-0949.log8596119935863.tmp" "read")
        at      at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:488)
        at      at java.base/java.security.AccessController.checkPermission(AccessController.java:1071)
        at      at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
        at      at java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:742)
        at      at java.base/java.io.File.exists(File.java:831)
        at      at ch.qos.logback.core.rolling.helper.Compressor.gzCompress(Compressor.java:148)
        at      at ch.qos.logback.core.rolling.helper.Compressor.compress(Compressor.java:57)
        at      at ch.qos.logback.core.rolling.helper.Compressor$CompressionRunnable.run(Compressor.java:246)
        at      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
        at      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at      at java.base/java.lang.VirtualThread.run(VirtualThread.java:309)
@sdusart sdusart force-pushed the jdk21_with_security_manager branch from 5578bed to ae29de2 Compare November 21, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant