Conversation
Implement periodic timezone update using `tzset()` protected by a read-write lock. Replace `localtime_r` calls with thread-safe `datetime.sys_localtime_r` wrapper. This ensures rsyslog detects system timezone changes (e.g. `/etc/localtime`) without restart. The check is performed every 5 minutes. Reference: rsyslog#424 Co-authored-by: rgerhards <1482123+rgerhards@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello @rgerhards, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a long-standing issue where rsyslog failed to detect system timezone changes without a restart. It introduces a robust, thread-safe mechanism to periodically refresh timezone information by wrapping Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism for periodic timezone updates to handle system timezone changes without restarting rsyslog. This is achieved by wrapping localtime_r calls in a new datetime.sys_localtime_r function, which is protected by a read-write lock. A new updateTimezone function, also lock-protected, calls tzset() periodically.
The changes are well-implemented across various modules. I've found one critical issue and one opportunity for improvement:
- A missing
objUse()call for thedatetimeobject in theimpstatsplugin, which will likely lead to a crash. - The use of a magic number for the timezone update interval, which could be replaced by a constant to improve maintainability.
Overall, this is a valuable improvement for rsyslog's robustness in dynamic environments. Addressing the identified issues will make it even better.
| #if defined(OS_LINUX) || defined(_POSIX_VERSION) | ||
| struct tm tm_local; | ||
| localtime_r(&t, &tm_local); | ||
| datetime.sys_localtime_r(&t, &tm_local); |
| if (tvSelectTimeout.tv_sec > 300) | ||
| tvSelectTimeout.tv_sec = 300; /* we want to check for TZ updates at least every 5 minutes */ |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82a4bbed93
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #if defined(OS_LINUX) || defined(_POSIX_VERSION) | ||
| struct tm tm_local; | ||
| localtime_r(&t, &tm_local); | ||
| datetime.sys_localtime_r(&t, &tm_local); |
There was a problem hiding this comment.
Load datetime interface before calling sys_localtime_r
generateZabbixStats() now calls datetime.sys_localtime_r, but BEGINmodInit in this file never acquires the datetime interface via objUse(datetime, CORE_COMPONENT). Because DEFobjCurrIf(datetime) initializes the interface struct with null function pointers, enabling the Zabbix stats format on POSIX/Linux can dereference a null callback the first time stats are emitted and crash rsyslog.
Useful? React with 👍 / 👎.
| if (tvSelectTimeout.tv_sec > 300) | ||
| tvSelectTimeout.tv_sec = 300; /* we want to check for TZ updates at least every 5 minutes */ |
There was a problem hiding this comment.
Keep janitor interval independent from timezone polling
Capping wait_timeout() to 300 seconds makes the main loop wake every 5 minutes even when janitorInterval is configured higher, and janitorRun() is executed unconditionally after each wake. This changes existing behavior by effectively ignoring configured janitor intervals above 5 minutes, which can increase janitor callback frequency and operational overhead in production.
Useful? React with 👍 / 👎.
- Add `#include "obj-types.h"` to `runtime/datetime.h` to fix missing `datetime_if_t`. - Fix include order in `runtime/operatingstate.c` and `runtime/statsobj.c`. - Ensure `obj` is defined via `DEFobjStaticHelpers` where needed. - Implement thread-safe timezone handling with `datetime.updateTimezone()` and `datetime.sys_localtime_r`. - Apply code formatting via `devtools/format-code.sh`. - Reference: rsyslog#424 Co-authored-by: rgerhards <1482123+rgerhards@users.noreply.github.com>
- Add `#include "datetime.h"` to `runtime/nsd_mbedtls.c` to fix `unknown type name 'datetime_if_t'` error when `ENABLE_MBEDTLS` is set. - This ensures `datetime_if_t` is defined before `DEFobjCurrIf(datetime)` is expanded. - Verified compilation of other modified modules (`impstats`, `queue`, `rsyslogd`). - Reference: rsyslog#424 Co-authored-by: rgerhards <1482123+rgerhards@users.noreply.github.com>
Implement periodic timezone update using
tzset()protected by a read-write lock.Replace
localtime_rcalls with thread-safedatetime.sys_localtime_rwrapper.This ensures rsyslog detects system timezone changes (e.g.
/etc/localtime) without restart.The check is performed every 5 minutes.
PR created automatically by Jules for task 16606718362046625825 started by @rgerhards