Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket dialer hang on shutdown #1734

Closed
gdamore opened this issue Dec 18, 2023 · 0 comments
Closed

websocket dialer hang on shutdown #1734

gdamore opened this issue Dec 18, 2023 · 0 comments

Comments

@gdamore
Copy link
Contributor

gdamore commented Dec 18, 2023

We're seeing a blocking reap --

    frame #2: 0x000000010004b204 ws_test`nni_pthread_cond_wait(c=0x0000000135706b70, m=0x0000000135706b30) at posix_thread.c:121:12
    frame #3: 0x000000010004b1d8 ws_test`nni_plat_cv_wait(cv=0x0000000135706b70) at posix_thread.c:229:2
    frame #4: 0x00000001000405b0 ws_test`nni_cv_wait(cv=0x0000000135706b70) at thread.c:51:2
    frame #5: 0x0000000100065bbc ws_test`ws_dialer_free(arg=0x0000000135706af0) at websocket.c:2269:3
    frame #6: 0x000000010003d4d4 ws_test`nng_stream_dialer_free(d=0x0000000135706af0) at stream.c:152:3
    frame #7: 0x0000000100056da8 ws_test`wstran_dialer_fini(arg=0x0000000135706a70) at websocket.c:378:2
    frame #8: 0x000000010002fe80 ws_test`nni_dialer_destroy(d=0x000000013600a000) at dialer.c:42:3
    frame #9: 0x000000010003bf4c ws_test`dialer_reap(arg=0x000000013600a000) at socket.c:1600:2
    frame #10: 0x0000000100038564 ws_test`reap_worker(unused=0x0000000000000000) at reap.c:58:5
    frame #11: 0x0000000100040860 ws_test`nni_thr_wrap(arg=0x0000000100075e18) at thread.c:94:3
    frame #12: 0x000000010004b4d8 ws_test`nni_plat_thr_main(arg=0x0000000100075e18) at posix_thread.c:266:2
    frame #13: 0x00000001864fbfa8 libsystem_pthread.dylib`_pthread_start + 148
  thread #24, name = 'nng:aio:expire'
    frame #0: 0x00000001864bf710 libsystem_kernel.dylib`__psynch_cvwait + 8
    frame #1: 0x00000001864fc574 libsystem_pthread.dylib`_pthread_cond_wait + 1232

This is waiting for the d->wspend (pending connections, i.e. those still negotiating) to drop to empty.

Probably we should just forcibly tear them down, when the dialer is shutting down.

A deferred clean up (but not blocking inside reap!) might be preferrable as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant