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

Interesting issue on ZFS and FreeBSD #77

Open
dmilith opened this issue Feb 18, 2021 · 1 comment
Open

Interesting issue on ZFS and FreeBSD #77

dmilith opened this issue Feb 18, 2021 · 1 comment

Comments

@dmilith
Copy link

dmilith commented Feb 18, 2021

I did logging for my Krecik app as you may know already… but I also did a second application to watch log changes using kquque: https://github.com/VerKnowSys/lw

Thing is… I test it on my ZFS-on-root FreeBSD system, where Krecik logs to /var/log/krecik/krecik.log-2021-02-18 files. And it does a great job, BUT! There's no event about file modification sent from those files at all.

I wonder - if that's about doing sync() rarely or sth like that? Is there a way to let's say… tell fern to sync to disk manually somehow? Any ideas what can cause kqueue events not be sent from files written by fern logger? :)

@daboross
Copy link
Owner

Interesting issue!

I wonder - if that's about doing sync() rarely or sth like that? Is there a way to let's say… tell fern to sync to disk manually somehow? Any ideas what can cause kqueue events not be sent from files written by fern logger? :)

As it happens, yeah - I don't think fern will ever trigger sync manually right now. I think adding configuration for this could definitely be a good idea - flushing / syncing every x logs or x bytes could help ensure lack of data loss.

I'd thought you could trigger this manually with log::logger().flush(), but I think even that might not actually do it? Fern implements flushing for files by calling std::io::Write::flush, which appears to be implemented separately from File::fsync - and on Unix systems, at least, is a no-op. Flushing will ensure we write all data from our internal buffer to the file, so it isn't totally useless, but it doesn't fsync. Fixing this so flush performs an fsync, or at least something can trigger an fsync, seems like a good idea.

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