fix: drain full OpenSSL error queue in croakSsl()#109
Merged
atoomic merged 3 commits intoMar 18, 2026
Conversation
Collaborator
|
view errors from smokers @Koan-Bot rebase |
croakSsl() called ERR_get_error() once, which returns the oldest error from the queue. When OpenSSL pushes multiple errors for a single operation, or when a previous eval-caught failure leaves stale errors, the reported message could be wrong or misleading. Loop ERR_get_error() until the queue is empty and report the last (most recent) error, which is typically the most descriptive. This also removes the need for a separate ERR_clear_error() call since the loop fully drains the queue. Add t/error_queue.t to verify error messages remain meaningful after multiple eval-caught failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b1d6ece to
db39227
Compare
Contributor
Author
Rebase: fix: drain full OpenSSL error queue in croakSsl()Branch Diff: 3 files changed, 44 insertions(+), 5 deletions(-) Review feedback was analyzed and applied. Actions
CICI failed initially, fixed on attempt 1. Automated by Kōan |
timlegge
approved these changes
Mar 18, 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.
What
croakSsl()now drains the full OpenSSL error queue and reports the last error instead of the first.Why
ERR_get_error()returns errors FIFO — oldest first. When OpenSSL pushes multiple errors for a single operation, or when a previouseval-caught failure leaves stale errors on the queue,croakSsl()reported the wrong (oldest/stale) error. This made debugging confusing: the error message described a previous failure, not the current one.Confirmed with a C test program: manually pushing a stale error before triggering a real decrypt failure causes the old code to report the stale error.
How
Loop
ERR_get_error()until the queue is empty, keeping the last error code. Use that for the error message. This also removes the need for the separateERR_clear_error()call since the loop fully drains the queue.Testing
t/error_queue.t(4 tests): multipleeval-caught failures in sequence, verifying error messages remain meaningful and don't leak stale errors.🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 42 insertions(+), 3 deletions(-)
Code scan: clean
Tests: failed (23 Failed, 9 tests)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline