Repository navigation
Add crash diagnostics and fix EAL lifecycle management - #15
Merged
Merged
Conversation
The Eal struct returned by Eal::init() was not bound to a variable in get_or_init_dpdk(), causing it to be dropped immediately. Eal::drop() calls rte_eal_cleanup(), which tears down the DPDK memory subsystem and NULLs rte_config->mem_config. The subsequent rte_pktmbuf_pool_create() then segfaults dereferencing NULL+8. Fix: store the Eal handle in DpdkResources so it lives as long as DPDK resources are in use. rte_eal_cleanup() now only runs when all socket references are dropped. Also adds crash diagnostics to integration tests: - Enable coredumps on EC2 instances (core_pattern -> /tmp/coredumps/) - check_process_crash() in harness-common.sh detects signal-killed processes, captures dmesg, coredump listings, and GDB backtraces - Crash reports written to /tmp/crash-report-*.txt for log collection - run-integration-tests.sh now collects dmesg, coredumps, and crash reports as part of instance log artifacts https://claude.ai/code/session_01AZJMrh5NfoHGEYuNHfiwP1
The stubs were previously stateless — rte_eal_cleanup was a no-op and rte_pktmbuf_pool_create always succeeded. This meant the Eal drop bug (init -> cleanup -> use) was invisible in unit tests. Changes: - stubs.rs: Track EAL state (never-init / initialized / cleaned-up). rte_pktmbuf_pool_create returns NULL when EAL has been cleaned up, matching the segfault behavior of real DPDK. - eal.rs: Add 3 unit tests that verify EAL lifecycle and catch the exact bug pattern that caused the production segfault. - backend_dpdk.rs: Fix same Eal drop bug (Eal::init return discarded). DpdkBackend::new() now stores the Eal handle. https://claude.ai/code/session_01AZJMrh5NfoHGEYuNHfiwP1
The EAL lifecycle tests mutate a global atomic (STUB_EAL_STATE). Running them in parallel with other tests is a race condition waiting to happen. - Add serial_test crate, mark all EAL tests with #[serial(eal)] - Add stub_eal_reset() for clean test setup/teardown instead of the hack of calling rte_eal_init(0, null) to paper over dirty state - Each test now calls stub_eal_reset() at start and end https://claude.ai/code/session_01AZJMrh5NfoHGEYuNHfiwP1
Integration Test Failure (Run 22434997569)Branch: No failure-summary.json found receiver-user-data.log (7094 bytes, last 80 lines)sender-user-data.log (7094 bytes, last 80 lines)receiver-console-output.log (25403 bytes, last 80 lines)sender-console-output.log (25598 bytes, last 80 lines)All instance-logs files |
gspivey
pushed a commit
that referenced
this pull request
Apr 13, 2026
No regression from hardware VLAN offload changes. At 700K PPS with 64B packets: rust-dpdk 665K RX (4.9% drop) vs native-dpdk 685K (2.1% drop) vs kernel 344K (50.8% drop). 1.93x throughput advantage over kernel. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
gspivey
added a commit
that referenced
this pull request
Jun 13, 2026
## Roadmap Item Implements roadmap item **#15**: `dpdk-stdlib-tcp`: Codec implementation and property tests. Tasks: 3.7, 3.8, 3.9, 3.10, 3.11 from `.kiro/specs/tcp-support/` ## Changes ### Codec functions (~500 LOC) - `build_tcp_frame(params) -> Vec<u8>`: Constructs Eth + IPv4 + TCP frames with full option serialization - `tcp_checksum(src_ip, dst_ip, tcp_segment) -> u16`: Parameterized pseudo-header checksum (ready for IPv6) - `compute_mss(mtu, ip_header_len) -> u16`: MSS calculation from MTU - `parse_tcp_packet(frame) -> ParsedTcpSegment`: Validates data-offset ≥ 5, parses all TCP options (MSS, WScale, SACK-Perm, Timestamps, SACK blocks) - `build_tcp_packet(mbuf, params)`: Zero-copy DPDK Mbuf path, byte-identical output to `build_tcp_frame` ### Automatic SYN option injection SYN/SYN-ACK frames always include MSS, WScale, SACK-Permitted, and Timestamps options (per spec requirement). ### Property tests (proptest, 256+ cases each) 1. **Round-trip**: `parse(build(params)) == params` for arbitrary valid segments 2. **Mbuf equivalence**: `build_tcp_frame` and `build_tcp_packet` produce identical bytes 3. **Invalid frame rejection**: Frames < 54B or invalid data-offset return error 4. **SYN required options**: SYN/SYN-ACK always contain MSS, WScale, SACK-Perm, Timestamps 5. **MSS bound**: `compute_mss` matches expected value 6. **Checksum validity**: Valid checksum verifies to 0; single-bit flip fails verification 7. **Sequence transitivity**: a < b < c ⟹ a < c (within half-space); n < n+1 always ### Unit tests - 32 unit tests covering flags, options, frame building, parsing, checksum validation, error cases ## Testing - `cargo build && cargo test` passes across the full workspace - All 42 unit tests + 10 property tests green - No regressions in existing crates ## Tradeoffs - `build_tcp_packet` pre-sets `data_len` to the full available data room before writing, then resets it to the actual frame length. This is necessary because stub mbufs start with data_len=0. Co-authored-by: Agent Router <agent@agent-router.dev>
gspivey
pushed a commit
that referenced
this pull request
Jun 13, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds comprehensive crash diagnostics to integration tests and fixes a critical bug in EAL (Environment Abstraction Layer) lifecycle management that could cause segmentation faults when DPDK resources are used after EAL cleanup.
Key Changes
EAL Lifecycle Management Fix
Ealhandle inDpdkBackendandDpdkResourcesstructs, ensuring EAL stays alive for the lifetime of all DPDK resourcesCrash Diagnostics Infrastructure
check_process_crash()helper function that detects when background processes crash (killed by signal), captures signal information, extracts kernel dmesg output, retrieves coredump backtraces via GDB, and writes a crash summary reportulimit -c unlimitedand callcheck_process_crash()when background processes exit unexpectedlyulimit -c unlimited, creating/tmp/coredumpsdirectory, and configuring kernel core_patternNotable Implementation Details
https://claude.ai/code/session_01AZJMrh5NfoHGEYuNHfiwP1