Scogun / ktor-simple-cache

Apache License 2.0
17 stars 1 forks source link

Deadlock due to unhandled CallFailed in SimpleCache #19

Closed ShiinaKin closed 1 month ago

ShiinaKin commented 1 month ago

The lock acquired at: https://github.com/Scogun/ktor-simple-cache/blob/4273e003a2fae93f50a78601607245632f065d50/ktor-simple-cache/src/main/kotlin/com/ucasoft/ktor/simpleCache/SimpleCache.kt#L35-L41

will not released at: https://github.com/Scogun/ktor-simple-cache/blob/4273e003a2fae93f50a78601607245632f065d50/ktor-simple-cache/src/main/kotlin/com/ucasoft/ktor/simpleCache/SimpleCachePlugin.kt#L27-L30

when an exception is thrown within the route block. This results in a deadlock, causing the request to hang.

In my usual practice, I propagate exceptions from the Dao, Service, and Controller layers upwards and handle them globally using some handler like StatusPages in ktor.