downstream: invalidate TLS session before socket close - #12278
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe downstream connection teardown path now invalidates an active TLS session before closing its socket when TLS support is enabled. ChangesDownstream TLS cleanup
Estimated code review effort: 1 (Trivial) | ~5 minutes Mergeability Score: ⚪ Minimal · up to This localized teardown-ordering fix prevents deferred TLS cleanup from using a recycled socket descriptor, with no actionable merge-blocking risk remaining after normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Downstream teardown closes a TLS socket before invalidating the associated
TLS session. Session destruction is deferred, so the operating system can
reuse the numeric file descriptor before OpenSSL calls
SSL_shutdown().That allows the old TLS session to write a close-notify record into a new
connection, which clients report as
bad record macorunexpected message.Change
Invalidate an active downstream TLS session before closing its socket. This
matches the existing upstream teardown ordering and prevents deferred TLS
cleanup from using a recycled descriptor.
Impact
Concurrent TLS listeners no longer risk corrupting newly accepted connections
during deferred downstream cleanup.
Validation
cmake -S . -B build -DFLB_TESTS_RUNTIME=On -DFLB_TESTS_INTERNAL=Oncmake --build build -j8ctest --test-dir build -R 'flb-it-(downstream_worker|http_server|opentelemetry)' --output-on-failureVALGRIND=1 VALGRIND_STRICT=1masterAll checks passed.
Summary by CodeRabbit