mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-04-26 03:10:29 +02:00
Test: log number of active read/write pumps in case of error.
Also dump goroutines to help tracking down what is blocking cleanup.
This commit is contained in:
parent
89637c0a51
commit
6395b87577
|
@ -284,7 +284,8 @@ func WaitForHub(ctx context.Context, t *testing.T, h *Hub) {
|
|||
case <-ctx.Done():
|
||||
h.mu.Lock()
|
||||
h.ru.Lock()
|
||||
t.Errorf("Error waiting for clients %+v / rooms %+v / sessions %+v to terminate: %s", h.clients, h.rooms, h.sessions, ctx.Err())
|
||||
dumpGoroutines()
|
||||
t.Errorf("Error waiting for clients %+v / rooms %+v / sessions %+v / %d read / %d write to terminate: %s", h.clients, h.rooms, h.sessions, readActive, writeActive, ctx.Err())
|
||||
h.ru.Unlock()
|
||||
h.mu.Unlock()
|
||||
return
|
||||
|
|
|
@ -68,7 +68,12 @@ func ensureNoGoroutinesLeak(t *testing.T, f func(t *testing.T)) {
|
|||
}
|
||||
|
||||
if after != before {
|
||||
profile.WriteTo(os.Stderr, 2) // nolint
|
||||
dumpGoroutines()
|
||||
t.Fatalf("Number of Go routines has changed from %d to %d", before, after)
|
||||
}
|
||||
}
|
||||
|
||||
func dumpGoroutines() {
|
||||
profile := pprof.Lookup("goroutine")
|
||||
profile.WriteTo(os.Stderr, 2) // nolint
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue