Skip to content

[v26.1.x] ossl: error queue assert to only terminate in debug builds#275

Merged
pgellert merged 1 commit intoredpanda-data:v26.1.xfrom
pgellert:ossl/relax-err-queue-assert-26-1
May 1, 2026
Merged

[v26.1.x] ossl: error queue assert to only terminate in debug builds#275
pgellert merged 1 commit intoredpanda-data:v26.1.xfrom
pgellert:ossl/relax-err-queue-assert-26-1

Conversation

@pgellert
Copy link
Copy Markdown

@pgellert pgellert commented Apr 29, 2026

Openssl's api contract is too loose and the impact to wide (e.g. low-priority https traffic could crash the whole process) that it makes sense to only terminate here in debug builds.

(cherry picked from commit 6eac50d)

CORE-15655

@pgellert pgellert requested a review from a team April 29, 2026 15:53
@pgellert pgellert self-assigned this Apr 29, 2026
@pgellert pgellert requested review from Copilot, dotnwat and nguyen-andrew and removed request for a team and nguyen-andrew April 29, 2026 15:53
@pgellert pgellert changed the title ossl: error queue assert to only terminate in release builds [v26.1.x] ossl: error queue assert to only terminate in release builds Apr 29, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies the TLS/OpenSSL session error-queue verification logic to avoid terminating the process when OpenSSL leaves stale errors on the per-thread error queue, by replacing an always-on SEASTAR_ASSERT with a standard assert.

Changes:

  • Replace SEASTAR_ASSERT with assert in verify_clean_error_queue() when stale OpenSSL errors are detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/net/ossl.cc
Comment on lines 1858 to 1862
char buf[256];
ERR_error_string_n(err, buf, sizeof(buf));
tls_log.warn("{} stale error on queue before {}: {}", *this, operation, buf);
SEASTAR_ASSERT(0 && "stale errors on OpenSSL error queue");
assert(0 && "stale errors on OpenSSL error queue");
}
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

In release builds (when NDEBUG is defined), assert(...) compiles out, so this function will only log a warning and then continue without clearing the OpenSSL error queue. That leaves the queue dirty, which contradicts the function’s contract and can still poison subsequent SSL_get_error classifications (as noted in the comment above). Consider draining/clearing the error queue here in all builds, and making the termination behavior conditional on a debug-only define (e.g., SEASTAR_DEBUG) rather than relying on assert disappearing.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Comment thread src/net/ossl.cc
@pgellert pgellert changed the title [v26.1.x] ossl: error queue assert to only terminate in release builds [v26.1.x] ossl: error queue assert to only terminate in debug builds Apr 29, 2026
Openssl's api contract is too loose and the impact to wide (e.g.
low-priority https traffic could crash the whole process) that it makes
sense to only terminate here in debug builds.

(cherry picked from commit 6eac50d)
@pgellert pgellert force-pushed the ossl/relax-err-queue-assert-26-1 branch from 2f22d7e to 6447189 Compare April 29, 2026 17:48
@pgellert
Copy link
Copy Markdown
Author

force-push: noop, fix typo in commit title

@pgellert pgellert merged commit 4152d2f into redpanda-data:v26.1.x May 1, 2026
29 checks passed
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