-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Problem statement
When prudent=true
and logs are being written continuously (generally at a decent rate where file locks are not really idle), readers fail with java.io.IOException: Permission denied
. This also affects simple commands like cat, which cannot read the file during writes.
Stacktrace (example)
Caused by: java.io.IOException: Permission denied
at java.base/sun.nio.ch.UnixFileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.UnixFileDispatcherImpl.read(UnixFileDispatcherImpl.java:51)
...
at java.base/java.io.BufferedReader$1.hasNext(BufferedReader.java:681)
... 66 common frames omitted
Here are some details about my environment:
Storage: Azure Files with SMB protocol
Deployment: Kubernetes, more than one node writing to the same log file.
java.vendor.version: Corretto-21.0.7.6.1
Observation
This PR was included in the 1.4.x+ versions which now actually calls FileChannel.lock
and did not happen throughout 1.2.x releases.
So, I see that, in 1.2.x, prudent was ineffective — no locks were taken, so readers could still access the file. (As good as prudent - false?)
But from 1.4.x and onwards, prudent=true causes readers to fail. Logback doc seems to be mentioning potential deadlock situation(in network shared files) but I nothing about possibility of rejected reads. Is there a way to configure Logback (or recommend any other alternative approach) so that multiple JVMs can write safely without blocking readers?
Thanks!