seaf-daemon segfaults in OpenSSL after notification context failures
Summary
seaf-daemon crashed twice with SIGSEGV while doing HTTPS sync requests. In both core dumps, the fault is in pthread_rwlock_rdlock() called by CRYPTO_THREAD_read_lock() → ERR_lib_error_string() → libcurl. The lock argument is null, and the fault address is 0x18.
Before both crashes, the client logged repeated failed to create libwebsockets context messages from notif-mgr.c:859. A possible cause is that tearing down the notification context calls OPENSSL_cleanup() while other Seafile threads are still using OpenSSL through libcurl. This is a hypothesis from the code path and matching timing, not a captured stack showing the cleanup call itself.
Environment
- Linux x86_64, Arch-based distribution, kernel
7.2.5-4-omarchy seafileandseafile-client9.0.21-1(AUR builds)libwebsockets4.5.8-3,openssl3.6.4-1,curl8.22.0-1,glibc2.44+r24+g16be1518495f-1- Two HTTPS Seafile servers configured. One supports the notification server; the other does not. The client log reports notification support only for the former.
Observed behavior
- During a period of DNS resolution failures and HTTPS timeouts,
seaf-daemonloggedfailed to create libwebsockets contextonce per minute for several minutes. - It segfaulted at
2026-09-26 11:35:38 CEST, and again at2026-09-27 07:26:08 CEST. - The applet restarted the daemon after each crash. After restart, it connected to the notification server successfully.
Relevant log excerpts (server names and repository IDs redacted):
[09/26/26 11:31:38] notif-mgr.c(859): failed to create libwebsockets context
[09/26/26 11:32:38] notif-mgr.c(859): failed to create libwebsockets context
...
[09/26/26 11:35:38] notif-mgr.c(859): failed to create libwebsockets context
[09/26/26 11:35:38] http-tx-mgr.c(833): libcurl failed to GET https://<server>/seafhttp/repo/<repo>/commit/HEAD: Timeout was reached.
[09/26/26 11:35:38] http-tx-mgr.c(833): libcurl failed to GET https://<server>/seafhttp/repo/<repo>/commit/HEAD: SSL connect error.
[09/27/26 07:15:02] notif-mgr.c(859): failed to create libwebsockets context
... (once per minute)
[09/27/26 07:26:02] notif-mgr.c(859): failed to create libwebsockets contextBoth core dumps have the same top frames:
#0 pthread_rwlock_rdlock
#1 CRYPTO_THREAD_read_lock (libcrypto.so.3)
#2 ERR_lib_error_string (libcrypto.so.3)
#3 ... (libcrypto.so.3)
#4 ... (libcurl.so.4)
...
#16 curl_easy_perform (libcurl.so.4)With the matching seafile-debug package, the Seafile frames differ only in which sync request was active:
2026-09-26:
#17 http_get daemon/http-tx-mgr.c:831
#18 check_head_commit_thread daemon/http-tx-mgr.c:1603
2026-09-27:
#17 http_post daemon/http-tx-mgr.c:1129
#18 http_tx_manager_get_head_commit_ids daemon/http-tx-mgr.c:2643
#19 update_head_commit_ids_for_server daemon/sync-mgr.c:3292GDB shows rdi = 0x0 in pthread_rwlock_rdlock() for the September 27 crash; the kernel reports a segfault at 0x18. There was no OOM kill.
Suspected mechanism
Seafile sets LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT for HTTPS notification contexts in notif-mgr.c. A failed lws_create_context() returns through a context teardown path in libwebsockets. In libwebsockets 4.5.8, teardown of the last context using global SSL initialization calls OPENSSL_cleanup(). OpenSSL warns against calling this while other code in the process still uses it.
The server without notification support appears unrelated: Seafile's support check starts a notification worker only after a positive check, and the logs identify only the supporting server as enabled. The context creation failures occur before a WebSocket connection to a server is attempted.
Expected behavior / request
Network or notification context failures should leave ordinary HTTPS sync requests running, or return a recoverable error. Could the daemon avoid process-wide OpenSSL cleanup while libcurl may still use OpenSSL, and log the underlying reason for lws_create_context() failure? I can provide the full logs or sanitized core details if needed.
Source: haiwen/seafile