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

Dropping Log lines when logBuffer.tryClaim fails to get positive claim value #106

Open
ayubkhan opened this issue Mar 2, 2023 · 1 comment

Comments

@ayubkhan
Copy link

ayubkhan commented Mar 2, 2023

We are loosing logs using this library. We have tried bufferSizeMegabytes="128" but still can reproduce.

https://github.com/tkowalcz/tjahzi/blob/master/core/src/main/java/pl/tkowalcz/tjahzi/TjahziLogger.java#L35

I have tested this with "LokiAppenderTest.java" after modifying TjahziLogger.java to randomly fix claim=0.
When claim=0, the "LokiAppenderTest.java" test fails after repeatedly printing status logs.

    public TjahziLogger log(long timestamp,
                            LabelSerializer serializedLabels,
                            ByteBuffer line) {
...
        int claim = logBuffer.tryClaim(LOG_MESSAGE_TYPE_ID, requiredSize);
        boolean tryToFail = new Random().nextBoolean();
        if (tryToFail) {
            claim = 0;
        }
        if (claim > 0) {
            putMessageOnRing(
@tkowalcz
Copy link
Owner

tkowalcz commented Mar 3, 2023

Thanks for the bug report. I'll investigate.

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

No branches or pull requests

2 participants