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(
|
log.debug(
|
||||||
s"wrap: status=${result.getStatus} handshake=$lastHandshakeStatus remaining=${userInBuffer.remaining} out=${transportOutBuffer
|
s"wrap: status=${result.getStatus} handshake=$lastHandshakeStatus remaining=${userInBuffer.remaining} out=${transportOutBuffer
|
||||||
.position()}")
|
.position()}")
|
||||||
|
|
||||||
if (lastHandshakeStatus == FINISHED) handshakeFinished()
|
if (lastHandshakeStatus == FINISHED) handshakeFinished()
|
||||||
runDelegatedTasks()
|
runDelegatedTasks()
|
||||||
result.getStatus match {
|
result.getStatus match {
|
||||||
case OK =>
|
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()
|
flushToTransport()
|
||||||
userInChoppingBlock.putBack(userInBuffer)
|
userInChoppingBlock.putBack(userInBuffer)
|
||||||
case CLOSED =>
|
case CLOSED =>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue