stream: add assertion against JDK bug to avoid spin loop in TlsActor (#30043)
* stream: add assertion against JDK bug to avoid spin loop in TlsActor Refs #29922
This commit is contained in:
parent
4081638fd8
commit
0576acc1da
1 changed files with 10 additions and 0 deletions
|
|
@ -368,10 +368,20 @@ import akka.util.ByteString
|
|||
log.debug(
|
||||
s"wrap: status=${result.getStatus} handshake=$lastHandshakeStatus remaining=${userInBuffer.remaining} out=${transportOutBuffer
|
||||
.position()}")
|
||||
|
||||
if (lastHandshakeStatus == FINISHED) handshakeFinished()
|
||||
runDelegatedTasks()
|
||||
result.getStatus match {
|
||||
case OK =>
|
||||
// https://github.com/akka/akka/issues/29922
|
||||
// It seems to be possible to get the SSLEngine into a state where
|
||||
// result.getStatus == OK && getHandshakeStatus == NEED_WRAP but
|
||||
// it doesn't make any progress any more.
|
||||
//
|
||||
// We guard against this JDK bug by checking for reasonable invariants after the call to engine.wrap
|
||||
if (!(transportOutBuffer.position() > 0 || lastHandshakeStatus != NEED_WRAP))
|
||||
throw new IllegalStateException("SSLEngine trying to loop NEED_WRAP without producing output")
|
||||
|
||||
flushToTransport()
|
||||
userInChoppingBlock.putBack(userInBuffer)
|
||||
case CLOSED =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue