mirror of https://github.com/sbt/sbt.git
[2.x] fix: Catch timeout on sbtn exit (#9239)
**Problem** sbtn tries to wait on a thread on exit, and times out. **Solution** Shorten the timeout and catch it.
This commit is contained in:
parent
46f0b89642
commit
df038e78a7
|
|
@ -135,13 +135,14 @@ private[sbt] class ServerSessionImpl(
|
||||||
*/
|
*/
|
||||||
override def close(): Unit = if (closed.compareAndSet(false, true)) {
|
override def close(): Unit = if (closed.compareAndSet(false, true)) {
|
||||||
running.set(false)
|
running.set(false)
|
||||||
try {
|
try
|
||||||
out.close()
|
out.close()
|
||||||
socket.close()
|
socket.close()
|
||||||
} catch { case _: IOException => }
|
catch case _: IOException => ()
|
||||||
onClose()
|
onClose()
|
||||||
if (Thread.currentThread() != readThread)
|
if Thread.currentThread() != readThread then
|
||||||
readThread.joinFor(ServerSessionImpl.ReadThreadDestroyTimeout)
|
try readThread.joinFor(ServerSessionImpl.ReadThreadDestroyTimeout)
|
||||||
|
catch case _: TimeoutException => ()
|
||||||
}
|
}
|
||||||
|
|
||||||
override def nextId(): String = UUID.randomUUID.toString
|
override def nextId(): String = UUID.randomUUID.toString
|
||||||
|
|
@ -351,7 +352,7 @@ private[sbt] class ServerSessionImpl(
|
||||||
|
|
||||||
private[sbt] object ServerSessionImpl {
|
private[sbt] object ServerSessionImpl {
|
||||||
val ReadIoTimeout: Int = 5000 // ms
|
val ReadIoTimeout: Int = 5000 // ms
|
||||||
val ReadThreadDestroyTimeout: FiniteDuration = 5.seconds
|
val ReadThreadDestroyTimeout: FiniteDuration = 1.seconds
|
||||||
val ResponseTimeout: FiniteDuration = 1.minutes
|
val ResponseTimeout: FiniteDuration = 1.minutes
|
||||||
val GracefulShutdownTimeout: FiniteDuration = 5.seconds
|
val GracefulShutdownTimeout: FiniteDuration = 5.seconds
|
||||||
val DestroyTimeout: FiniteDuration = 10.seconds
|
val DestroyTimeout: FiniteDuration = 10.seconds
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue