Skip to content

feat(server,mcp): add systemd watchdog integration#3233

Merged
hubcio merged 5 commits into
apache:masterfrom
jpds:feat/systemd-service-notifications
May 13, 2026
Merged

feat(server,mcp): add systemd watchdog integration#3233
hubcio merged 5 commits into
apache:masterfrom
jpds:feat/systemd-service-notifications

Conversation

@jpds
Copy link
Copy Markdown
Contributor

@jpds jpds commented May 11, 2026

Which issue does this PR close?

None.

Rationale

I run my services under systemd - this is a simple integration to have the iggy runtime ping systemd per it's sd_notify integration.

This does not have any effect when the systemd unit is not configured as Type=notify and without WatchdogSec=.

Local Execution

Validated in a set of VMs with the NixOS integration testing framework:

vm-test-run-iggy> server # [   13.822570] iggy-server[937]: 2026-05-11T15:31:32.946941Z  INFO shard-0 server::shard::tasks::periodic::systemd_watchdog: Systemd watchdog enabled, pinging every 15s (timeout: 30s).
vm-test-run-iggy> mcp # [   14.012098] iggy-mcp[860]: 2026-05-11T15:31:33.267809Z  INFO iggy_mcp::systemd: Systemd watchdog enabled, pinging every 15s (timeout: 30s).

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.29%. Comparing base (9b9be19) to head (575b29e).

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3233       +/-   ##
=============================================
- Coverage     73.82%   51.29%   -22.53%     
  Complexity      943      943               
=============================================
  Files          1190     1188        -2     
  Lines        107832    94126    -13706     
  Branches      84849    71158    -13691     
=============================================
- Hits          79606    48282    -31324     
- Misses        25469    43242    +17773     
+ Partials       2757     2602      -155     
Components Coverage Δ
Rust Core 44.90% <100.00%> (-29.97%) ⬇️
Java SDK 60.14% <ø> (ø)
C# SDK 69.13% <ø> (-0.31%) ⬇️
Python SDK 81.43% <ø> (ø)
Node SDK 91.44% <ø> (-0.10%) ⬇️
Go SDK 39.80% <ø> (ø)
Files with missing lines Coverage Δ
core/ai/mcp/src/main.rs 53.53% <ø> (ø)
core/server/src/shard/mod.rs 90.66% <100.00%> (+0.04%) ⬆️
...re/server/src/shard/tasks/oneshot/config_writer.rs 79.51% <ø> (ø)

... and 298 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jpds jpds changed the title systemd: Add watchdog integration feat(server,mcp): add systemd watchdog integration May 11, 2026
@jpds jpds force-pushed the feat/systemd-service-notifications branch from bcc3104 to 68e7144 Compare May 11, 2026 18:21
Copy link
Copy Markdown
Contributor

@hubcio hubcio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall i think it's solid PR, at first I didn't want to create systemd dependency in iggy itself but your feature approach seems reasonable. i have a couple of follow-up items not tied to a specific line in this diff:

  • track an issue to port systemd integration to core/server-ng because current core/server will be replaced by it (this is for us, we dont want to forget it before release)
  • optional follow-up PR, preferably docs only for https://iggy.apache.org/docs/ (repo https://github.com/apache/iggy-website/ ): iggy-server.service skeleton with Type=notify, recommended WatchdogSec=, and hardening directives (ProtectSystem, PrivateTmp, NoNewPrivileges, CapabilityBoundingSet). i think it would be nice-to-have.

also: will the compilation for macos with feature systemd fail? or is systemd crate portable and uses some macos mechanism?

Comment thread core/server/src/shard/tasks/oneshot/config_writer.rs Outdated
Comment thread core/server/src/shard/mod.rs Outdated
Comment thread core/ai/mcp/src/systemd.rs
Comment thread core/server/src/shard/mod.rs Outdated
jpds added 5 commits May 12, 2026 13:45
Send READY=1 after all protocol listeners bind, WATCHDOG=1 at half
the configured WatchdogSec interval (shard 0 only), and STOPPING=1
on graceful shutdown. Gated behind the optional 'systemd' feature flag.
Send READY=1 after the transport (stdio or HTTP) begins serving,
WATCHDOG=1 at half the configured WatchdogSec interval, and STOPPING=1
on graceful shutdown. Gated behind the optional 'systemd' feature flag.
@jpds jpds force-pushed the feat/systemd-service-notifications branch from 68e7144 to 575b29e Compare May 12, 2026 12:45
@jpds
Copy link
Copy Markdown
Contributor Author

jpds commented May 12, 2026

also: will the compilation for macos with feature systemd fail? or is systemd crate portable and uses some macos mechanism?

sd-notify itself is pure Rust, there's no libsystemd linkage, so --features systemd would compile fine on macOS; and then just no-op at runtime since no notification socket is set.

I've adjusted the code to address the review comments.

optional follow-up PR, preferably docs only for https://iggy.apache.org/docs/ (repo https://github.com/apache/iggy-website/ ): iggy-server.service skeleton with Type=notify, recommended WatchdogSec=, and hardening directives (ProtectSystem, PrivateTmp, NoNewPrivileges, CapabilityBoundingSet)

I already made a systemd unit definition over at NixOS/nixpkgs#519080 (if you want to pinch ideas from it).

@hubcio hubcio merged commit a4b6a8d into apache:master May 13, 2026
80 checks passed
@hubcio
Copy link
Copy Markdown
Contributor

hubcio commented May 13, 2026

@jpds thanks for contribution. we merged this, but upcoming release will take from 2-3 weeks to 2-3 months, depend on when we finish cluster feature.

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.

3 participants