mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-17 11:52:39 +02:00
Why: Disk and disk-assisted queues must not leave stale corrupted queue segments live after runtime dequeue corruption. The disk-assisted child is also a real disk queue, so it needs the same corruption semantics as a queue configured directly as disk. Impact: Safe-mode corruption recovery now quarantines unread runtime queue tails for pure disk and disk-assisted queues and logs visible recovery messages. Before/After: Before, some runtime corruptions could fall back to invalid .qi recovery or leave DA disk child handling inconsistent; after, unread corrupted tails are quarantined and fresh queue state is constructed. Technical Overview: Propagate queue.onCorruption from the DA parent to the disk child. Apply bounded runtime corruption recovery to DA disk children as well as pure disk queues. Keep the existing single-record invalid .qi recovery path separate so the legacy DA .qi test still exercises that scenario. Reset disk state after quarantine without double-subtracting imdiag queue counters, and subtract skipped logical tail records explicitly. Add pure disk and DA segment-corruption tests that verify quarantine, user-visible messages, and fresh live queue files only. Document that DA mode is an in-memory parent plus a first-class disk child with normal disk queue semantics. With the help of AI-Agents: Codex
4.0 KiB
4.0 KiB
AGENTS.md – Runtime subtree
These instructions apply to all files under runtime/, which implement the
rsyslog core (message queues, networking backends, parsers, scheduler, stats
collection, and process orchestration).
Purpose & scope
- Treat this tree as the authoritative implementation of the rsyslog engine. Changes here affect every module and deployment profile.
- Consult the top-level
AGENTS.mdand component-specific guides (e.g.plugins/AGENTS.md) when a change crosses directory boundaries.
Key components
rsyslog.c/rsyslog.h: main entry point and daemon lifecycle helpers.modules.c,module-template.h: module loader contracts shared withplugins/andcontrib/.queue.c,wti.c,wtp.c: work queue implementation and worker threads. Disk-assisted mode creates two queue objects: an in-memory parent and a first-class disk child (pqDA). Disk queue semantics for.qistate, segment files,queue.onCorruption, quarantine, and runtime corruption handling apply to the DA child just as they apply to pure disk queues.tcpsrv.c,tcpclt.c,net*.c: TCP/TLS listeners and clients.parser.c,prop.c,template.c: core message parsing and property engine.statsobj.c,dynstats*.c: statistics registry and dynamic counters.timezones.c,datetime.c: time conversion helpers.yamlconf.c/yamlconf.h: YAML configuration frontend — parses.yaml/.ymlfiles and produces the samecnfobj+nvlsttrees that the RainerScript grammar produces, then feeds them into the sharedcnfDoObj()backend inconf.c. Any change to config objects, statement types, template modifiers, or global parameters must be reflected here as well as ingrammar/. See thersyslog_configskill for parity rules.
Build & validation
- Efficient Build: Use
make -j$(nproc) check TESTS=""to incrementally build the core, shared libraries, and test dependencies. This ensures that tests can dynamically load the runtime via-M../runtime/.libs. - Bootstrap/Configure: Run
./autogen.shand./configure --enable-testbenchonly when build scripts change (configure.ac,Makefile.am, etc.) or if theMakefileis missing. Run these from the repository root. - Run Tests: Prefer targeted test runs:
- Directly invoke the most relevant shell test under
tests/(e.g../tests/queue-persist.sh). - Use
make check TESTS='<script>.sh'when you need automake’s harness or Valgrind variants (*-vg.sh). - For configuration validation edits, run
./tests/validation-run.sh.
- Directly invoke the most relevant shell test under
- When changing exported symbols, update
runtime/Makefile.amand ensure the library version script (if touched) remains consistent with existing SONAME policies.
Coding expectations
- Follow
COMMENTING_STYLE.mdand add/update "Concurrency & Locking" blocks in files that manage shared state (queues, network sessions, statistics). - Keep worker/thread behavior aligned with
MODULE_AUTHOR_CHECKLIST.mdrules: per-worker state stays inwrkrInstanceData_t, shared state is guarded in per-action data structures. - Update
doc/ai/module_map.yamlwhen locking guarantees, queue semantics, or exported helper APIs change so module authors know what to depend on. - Update or create unit helpers (e.g. under
tests/orruntime/hashtable/) when you modify reusable primitives.
Coordination & documentation
- Notify module owners (via metadata or review notes) when adjusting
module-template.h, initialization flows, or statistics surfaces consumed by plugins. - Cross-reference user docs in
doc/if behavior visible to operators changes (configuration syntax, stats counters, TLS requirements, etc.). - Leave
ChangeLogandNEWSedits to the maintainers; do not modify those files in routine patches.
Debugging tips
- Enable extra runtime logging with
export RSYSLOG_DEBUG="..."in tests (seetests/diag.sh) when chasing race conditions. - Use the testbench Valgrind helpers by running the corresponding
*-vg.shscripts to flush out memory and threading regressions.