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

Truncated output from file handler #14

Closed
ptaoussanis opened this issue Aug 1, 2024 · 6 comments
Closed

Truncated output from file handler #14

ptaoussanis opened this issue Aug 1, 2024 · 6 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ptaoussanis
Copy link
Member

Have had a report that the file handler may produce truncated output.

My hunch is that the :needs-stopping? dispatch option isn't being enabled by default for this handler (but should be).

TODO:

  • Check that :needs-stopping? is enabled by default for all relevant handlers
  • Confirm that this addresses the issue with truncated output
@ptaoussanis ptaoussanis added the bug Something isn't working label Aug 1, 2024
@ptaoussanis ptaoussanis added this to the Next beta milestone Aug 1, 2024
@ptaoussanis ptaoussanis self-assigned this Aug 1, 2024
@olavfosse
Copy link

Here's my MVE:

mve.tar.gz

@olavfosse
Copy link

olavfosse commented Aug 1, 2024

For passer-bys: archiving can be circumvented by setting :max-file-size to a very high integer

@ptaoussanis
Copy link
Member Author

For passer-bys: circumvented can be disabled by settings :max-file-size to a very high integer

That's helpful to know. The default max is meant to be 4MB, so could be there's something faulty with the logic there.

@olavfosse
Copy link

Oops, I accidentally replaced the wrong word 😅.. I meant to say "archiving can be circumvented by setting..."

FTR: on my machine telemere.log does fill up to 4mb before being archived. Nothing wrong in that regard.

Sorry for misleading you!

@ptaoussanis
Copy link
Member Author

ptaoussanis commented Aug 5, 2024

Update: just took a look at the example project and confirmed the problem 👍

Looks like it's actually the gzip code that's faulty, and incorrectly truncating input to exactly 4096 bytes. Should be a 1-line fix.

In the meantime, you can disable the gzip option in your example to see the correct behaviour:

(require '[taoensso.telemere :as tel])
(tel/add-handler! :durable
  (tel/handler:file
    {:output-fn (tel/pr-signal-fn)
     :max-file-size (* 1024 1024 4)
     :gzip-archives? false})
  {:needs-stopping? true})

(dotimes [n 1e6] (tel/log! n))

Thanks again for the report and example Olav!

@ptaoussanis
Copy link
Member Author

Closing, this is now fixed on dev branch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants