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

Logs Cannot Be Written After VM File Handles Are Used Up #1261

Open
HaitaoDeng opened this issue Feb 2, 2023 · 2 comments
Open

Logs Cannot Be Written After VM File Handles Are Used Up #1261

HaitaoDeng opened this issue Feb 2, 2023 · 2 comments
Labels
appenders Affects one or more Appender plugins bug Incorrect, unexpected, or unintended behavior of existing code waiting-for-maintainer

Comments

@HaitaoDeng
Copy link

Description

Fault injection: VM file handles are used up, and logs cannot be printed after the fault is rectified. IOException: Stream Closed.
[A clear and concise description of what the bug is.]

Configuration

Version: [Log4j version]
2.71.1
Operating system: [OS and version]
linux
JDK: [JDK distribution and version]
openjdk 1.8

Logs

Logs during fault injection:
image
Logs After Fault Recovery:
image

[Stacktraces, errors, etc. relevant applications logs.]

Reproduction

[An isolated test reproducing the test.
JUnit tests similar to the ones in the code base are extremely appreciated.]

org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager#writeToDestination
randomAccessFile should check whether The Stream is closed。
image

@rgoers
Copy link
Member

rgoers commented Feb 9, 2023

Once the file rollover fails the Appender is essentially dead as it no longer has an open stream. This is not unique to RandomAccessFile as all file appenders will face this. I really don't see a good way to fix this.

@HaitaoDeng
Copy link
Author

Once the file rollover fails the Appender is essentially dead as it no longer has an open stream. This is not unique to RandomAccessFile as all file appenders will face this. I really don't see a good way to fix this.

IOException handling,when Stream Closed, randomAccessFile is set to null. A new access file will be created next time. Is this OK?

@jvz jvz added bug Incorrect, unexpected, or unintended behavior of existing code appenders Affects one or more Appender plugins labels Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appenders Affects one or more Appender plugins bug Incorrect, unexpected, or unintended behavior of existing code waiting-for-maintainer
Projects
None yet
Development

No branches or pull requests

4 participants