Skip to content

[FIX] Close channel on TLS negotiation failure to prevent zombie conn…#16255

Open
LI123456mo wants to merge 4 commits intoapache:3.3from
LI123456mo:fix-tls-negotiation-exception
Open

[FIX] Close channel on TLS negotiation failure to prevent zombie conn…#16255
LI123456mo wants to merge 4 commits intoapache:3.3from
LI123456mo:fix-tls-negotiation-exception

Conversation

@LI123456mo
Copy link
Copy Markdown
Contributor

This pull request addresses a bug in SslServerTlsHandler where exceptions during the TLS handshake were swallowed, leaving TCP channels active but dead. By adding ctx.close() to exceptionCaught, the PR ensures that failed connections are closed, enabling the consumer to detect the failure and initiate self-healing.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.81%. Comparing base (6916d1b) to head (ea62549).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16255      +/-   ##
============================================
+ Coverage     60.78%   60.81%   +0.02%     
- Complexity    11763    11772       +9     
============================================
  Files          1953     1953              
  Lines         89186    89188       +2     
  Branches      13454    13454              
============================================
+ Hits          54209    54236      +27     
+ Misses        29400    29383      -17     
+ Partials       5577     5569       -8     
Flag Coverage Δ
integration-tests-java21 32.15% <0.00%> (-0.01%) ⬇️
integration-tests-java8 32.35% <0.00%> (+0.12%) ⬆️
samples-tests-java21 32.12% <0.00%> (-0.08%) ⬇️
samples-tests-java8 29.86% <0.00%> (+0.05%) ⬆️
unit-tests-java11 59.01% <100.00%> (+<0.01%) ⬆️
unit-tests-java17 58.49% <100.00%> (-0.02%) ⬇️
unit-tests-java21 58.51% <100.00%> (-0.01%) ⬇️
unit-tests-java25 58.47% <100.00%> (+<0.01%) ⬆️
unit-tests-java8 59.05% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zrlw
Copy link
Copy Markdown
Contributor

zrlw commented May 6, 2026

it might be better to add a testcase for it.

@zrlw zrlw added the status/waiting-for-feedback Need reporters to triage label May 6, 2026
"",
"TLS negotiation failed when trying to accept new connection.",
cause);
ctx.close();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should close context after calling fireExceptionCaught

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should close context after calling fireExceptionCaught

Thank you for the feedback, @zrlw. That makes sense—firing the exception first ensures the error is fully propagated through the pipeline before the channel is terminated. I will update the PR to swap the order: ctx.fireExceptionCaught(cause) followed by ctx.close().

@LI123456mo
Copy link
Copy Markdown
Contributor Author

it might be better to add a testcase for

Thanks for suggestion , will add

@LI123456mo LI123456mo force-pushed the fix-tls-negotiation-exception branch from ca8cdb7 to ea62549 Compare May 7, 2026 11:23
@LI123456mo
Copy link
Copy Markdown
Contributor Author

it might be better to add a testcase for it.

it might be better to add a testcase for it.
@zrlw , done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/waiting-for-feedback Need reporters to triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants