-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include a patch to fix nghttpx bug which causes TLS write stall
- Loading branch information
1 parent
55671e3
commit efff342
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
From cbcfdaa6555778a8c52d7d60b787dbd9d6a755ca Mon Sep 17 00:00:00 2001 | ||
From: Tatsuhiro Tsujikawa <[email protected]> | ||
Date: Mon, 6 Feb 2023 21:51:16 +0900 | ||
Subject: [PATCH] nghttpx: Fix bug that stalls TLS write | ||
|
||
--- | ||
src/shrpx_connection.cc | 19 ++++++++++++++++++- | ||
1 file changed, 18 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/shrpx_connection.cc b/src/shrpx_connection.cc | ||
index 8fcf54cb..9869e5f2 100644 | ||
--- a/src/shrpx_connection.cc | ||
+++ b/src/shrpx_connection.cc | ||
@@ -929,6 +929,10 @@ ssize_t Connection::write_tls(const void *data, size_t len) { | ||
|
||
tls.last_write_idle = -1.; | ||
|
||
+ auto &tlsconf = get_config()->tls; | ||
+ auto via_bio = | ||
+ tls.server_handshake && !tlsconf.session_cache.memcached.host.empty(); | ||
+ | ||
ERR_clear_error(); | ||
|
||
#if OPENSSL_1_1_1_API && !defined(OPENSSL_IS_BORINGSSL) | ||
@@ -958,7 +962,12 @@ ssize_t Connection::write_tls(const void *data, size_t len) { | ||
case SSL_ERROR_WANT_WRITE: | ||
tls.last_writelen = len; | ||
// starting write watcher and timer is done in write_clear via | ||
- // bio. | ||
+ // bio otherwise. | ||
+ if (!via_bio) { | ||
+ wlimit.startw(); | ||
+ ev_timer_again(loop, &wt); | ||
+ } | ||
+ | ||
return 0; | ||
case SSL_ERROR_SSL: | ||
if (LOG_ENABLED(INFO)) { | ||
@@ -974,6 +983,14 @@ ssize_t Connection::write_tls(const void *data, size_t len) { | ||
} | ||
} | ||
|
||
+ if (!via_bio) { | ||
+ wlimit.drain(rv); | ||
+ | ||
+ if (ev_is_active(&wt)) { | ||
+ ev_timer_again(loop, &wt); | ||
+ } | ||
+ } | ||
+ | ||
update_tls_warmup_writelen(rv); | ||
|
||
return rv; | ||
-- | ||
2.34.1 | ||
|