While investigating discovery tests in Polykey I found that they consistently took 20 seconds to complete. Digging deeper I found that the test was very quick, but stopping the QUICServer was taking about 17 seconds.
It turns out that in the case where the server has starting connection and we call quicServer.stop({force: true}) it will wait for the connection to time out rather that force it to stop. While stopping the server is calling connection.stop({ force: true}) but in this case the following happens.
The connection is starting holding the lifecycle lock.
connection.stop is called but since the connection is in a starting state it's awaiting the lock.
The connection times out entering a stopped state without entering the started state at any point.
stop gets the lock but resolves as a NOP operation since its not currently waiting.
So the main problem here is that we don't abort any starting connections when stopping the server. So we need to send an abort to any starting connections in this case.
Create a test demonstrating the condition involved.
Implement a method to send an abort signal with a server stopping symbol to any starting connections. This could just be a top level abort signal and controller for the whole QUICServer.
Specification
While investigating discovery tests in
Polykey
I found that they consistently took 20 seconds to complete. Digging deeper I found that the test was very quick, but stopping theQUICServer
was taking about 17 seconds.It turns out that in the case where the server has starting connection and we call
quicServer.stop({force: true})
it will wait for the connection to time out rather that force it to stop. While stopping the server is callingconnection.stop({ force: true})
but in this case the following happens.connection.stop
is called but since the connection is in a starting state it's awaiting the lock.stopped
state without entering thestarted
state at any point.stop
gets the lock but resolves as a NOP operation since its not currently waiting.So the main problem here is that we don't abort any starting connections when stopping the server. So we need to send an abort to any starting connections in this case.
Additional context
Tasks
QUICServer
.