Skip to content

Fix systemd journal hang when time is going backwards after a boot#4245

Merged
MrAnno merged 15 commits intosyslog-ng:masterfrom
bazsi:fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot
Jan 23, 2023
Merged

Fix systemd journal hang when time is going backwards after a boot#4245
MrAnno merged 15 commits intosyslog-ng:masterfrom
bazsi:fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot

Conversation

@bazsi
Copy link
Copy Markdown
Collaborator

@bazsi bazsi commented Dec 17, 2022

This branch fixes #2836 in addition to much needed love to the systemd-journal() module.

It implements features, improves performance and code readability.

  • the dynamic loading of libsystemd.so has greatly been simplified (the Journald wrapper is gone)
  • it improves performance by avoiding at least 3 mallocs per journal fields
  • it adds a matches() option to filter down the journal source, just as you can do with journalctl command line arguments
  • it adds a match-boot() option to filter down the journal source to the current boot

The match-boot() option will default to "yes" if you are using the system() source, "no" otherwise.

I worked from the patch provided by @TaborKelly originally but I am afraid most of his code will be completely eliminated by the time this is merged.

This needs some testing for sure, I am opening the PR to solicit feedback and to do that testing first, thus this is WIP.

@TaborKelly can you please check if this works for you? Thanks

@github-actions
Copy link
Copy Markdown
Contributor

No news file has been detected. Please write one, if applicable.

@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@bazsi bazsi force-pushed the fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot branch from 340f0dd to 7e79bc6 Compare December 17, 2022 13:50
@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@bazsi
Copy link
Copy Markdown
Collaborator Author

bazsi commented Dec 18, 2022

This is not yet operational, sorry. I am still fighting with the unit test.

@bazsi bazsi marked this pull request as draft December 18, 2022 19:20
@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@bazsi bazsi force-pushed the fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot branch from 333b333 to f062198 Compare December 28, 2022 07:50
@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@bazsi bazsi force-pushed the fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot branch from f062198 to 1637615 Compare December 28, 2022 17:20
@bazsi bazsi marked this pull request as ready for review December 28, 2022 17:21
@bazsi bazsi changed the title WIP: Fix systemd journal hang when time is going backwards after a boot Fix systemd journal hang when time is going backwards after a boot Dec 28, 2022
@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@bazsi bazsi force-pushed the fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot branch from 1637615 to f933714 Compare December 28, 2022 21:34
@kira-syslogng
Copy link
Copy Markdown
Contributor

Build FAILURE

@MrAnno
Copy link
Copy Markdown
Collaborator

MrAnno commented Jan 13, 2023

@kira-syslogng retest this please

bazsi added 14 commits January 14, 2023 13:20
We had typedefs and separate variables for various libsystemd related
functions, remove the typedefs as that's a lot of boilerplate.

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
This patch still retains the capability for loading libsystemd.so at runtime,
instead of linking to it specifically, but gets rid off a layer which does
not really provide us too much value.

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
… Glibisms

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
…of the journal

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
…t boot

This option is similar to "journalctl -b" which resolves an issue around
clocks going backwards accross boots.

Signed-off-by: @TaborKelly
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
@bazsi bazsi force-pushed the fix-systemd-journal-hang-when-time-is-going-backwards-after-a-boot branch from f933714 to 29a2ca3 Compare January 14, 2023 12:46
@bazsi
Copy link
Copy Markdown
Collaborator Author

bazsi commented Jan 14, 2023

added NEWS file, also updated the PR description to conclude on how we enable the new mode of operation.

@bazsi bazsi added this to the syslog-ng 4.1 milestone Jan 14, 2023
@MrAnno MrAnno self-requested a review January 14, 2023 13:54
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

Successfully merging this pull request may close these issues.

Syslog-ng stops logging on console after system time is changed

3 participants