-
Notifications
You must be signed in to change notification settings - Fork 8
Replace chrono with time (address RUSTSEC-2020-0071) #6
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
Open
jeff-hiner
wants to merge
1
commit into
Axcient:main
Choose a base branch
from
jeff-hiner:rustsec-2020-0071
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rolling-file" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
authors = ["Kevin Hoffman <[email protected]>"] | ||
edition = "2018" | ||
|
||
|
@@ -15,6 +15,7 @@ license = "MIT/Apache-2.0" | |
|
||
[dev-dependencies] | ||
tempfile = "3.0.5" | ||
time = { version = "0.3.17", features = ["local-offset", "macros"] } | ||
|
||
[dependencies] | ||
chrono = "0.4.23" | ||
time = { version = "0.3.17", features = ["local-offset"] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This change can introduce a memory leak due to time-rs/time#651
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A mach ports leak is better than a segfault, but this is something best addressed via a PR to the
num_threads
crate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is called quite frequently and every call will leak at least
numberOfThreads
mach ports. This can easily accumulate to several GB of leaked memory for long-running processes like daemons.It's also worth pointing out that
OffsetDateTime::now_local()
will always fail for macOS (unless the process is single threaded). Which makes this equivalent tolet now = OffsetDateTime::now_utc();
(on Apple platforms).It might make sense to consider rotating based on UTC instead of local time in general. This would save quite a few CPU cycles and it's what would happen on Apple platforms with the suggested code anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think rotating on UTC is a totally acceptable solution. I'm happy to modify the PR, but I haven't heard anything from the maintainer in over a year so I'm not sure if the crate is still being maintained.