Investigation of Linux freezes #3.

This commit is contained in:
cheatfate 2021-01-20 22:40:23 +02:00 committed by zah
parent cf42a5455e
commit f1b43aeb04
1 changed files with 5 additions and 3 deletions

View File

@ -274,12 +274,15 @@ proc failPendingWriteQueue(queue: var Deque[StreamVector],
vector.writer.fail(error) vector.writer.fail(error)
proc clean(server: StreamServer) {.inline.} = proc clean(server: StreamServer) {.inline.} =
echo "cleaning server instance"
if not(server.loopFuture.finished()): if not(server.loopFuture.finished()):
echo "cleaning server complete()"
untrackServer(server) untrackServer(server)
server.loopFuture.complete() server.loopFuture.complete()
if not isNil(server.udata) and GCUserData in server.flags: if not isNil(server.udata) and GCUserData in server.flags:
GC_unref(cast[ref int](server.udata)) GC_unref(cast[ref int](server.udata))
GC_unref(server) GC_unref(server)
echo "clean server exit"
proc clean(transp: StreamTransport) {.inline.} = proc clean(transp: StreamTransport) {.inline.} =
if not(transp.future.finished()): if not(transp.future.finished()):
@ -1639,8 +1642,7 @@ proc close*(server: StreamServer) =
## Please note that release of resources is not completed immediately, to be ## Please note that release of resources is not completed immediately, to be
## sure all resources got released please use ``await server.join()``. ## sure all resources got released please use ``await server.join()``.
proc continuation(udata: pointer) {.gcsafe.} = proc continuation(udata: pointer) {.gcsafe.} =
# Stop tracking server echo "server close() continuation"
if not(server.loopFuture.finished()):
server.clean() server.clean()
let r1 = (server.status == ServerStatus.Stopped) and let r1 = (server.status == ServerStatus.Stopped) and