mirror of
https://github.com/ElementsProject/lightning.git
synced 2026-08-16 13:00:32 +02:00
On macOS under load, subdaemons intermittently die: connectd: **BROKEN** STATUS_FAIL_HSM_IO: No hsmd ECDH response channeld: exits 0 after WIRE_HSMD_GET_PER_COMMITMENT_POINT Both are a synchronous wire_sync_read() returning NULL on a fresh connection. The HSM fd in a subdaemon is one end of a socketpair created by hsmd (whose io loop sets O_NONBLOCK on the other end) and passed hsmd -> lightningd -> subdaemon via SCM_RIGHTS. On macOS the O_NONBLOCK flag follows the shared open file description across that chain, so the subdaemon's fd can be non-blocking, and read()/write() return EAGAIN before hsmd's (fast) reply has landed. Linux keeps the descriptions independent, which is why this never reproduces there. The previous attempts to force the fd blocking from the subdaemon (io_fd_block in ecdh_hsmd_setup) cannot win, because hsmd owns the other end of the same open file description and keeps it non-blocking. Fix at the shared choke point instead: make wire_sync_read() and wire_sync_write() tolerant of O_NONBLOCK by polling on EAGAIN and resuming, preserving any partial read. "Sync" then really means "read or write a complete message", regardless of the fd's blocking state. This covers connectd's ecdh(), channeld's hsm_req(), and every other subdaemon that does synchronous HSM I/O (openingd, closingd, onchaind). Also drop the now-unneeded io_fd_block() toggling from ecdh_hsmd_setup(), and include errno in the HSM I/O failure messages so a recurrence is diagnosable from the daemon log. Changelog-Fixed: connectd: fix intermittent "No hsmd ECDH response" crash on macOS under load (issue #9060). |
||
|---|---|---|
| .. | ||
| test | ||
| bolt12_wire.csv | ||
| channel_type_wire.csv | ||
| extracted_bolt12_01_recurrence.patch | ||
| extracted_bolt12_02_payer_proofs.patch | ||
| extracted_onion_03_onionmsg-payload-as-bytearr.patch | ||
| extracted_onion_05_remove-onion_message.patch | ||
| extracted_peer-shutdown-wrong_funding.patch | ||
| extracted_peer_04_opt_will_fund.patch | ||
| extracted_peer_05_newonion.patch | ||
| extracted_peer_cln_batch_element.patch | ||
| fromwire.c | ||
| Makefile | ||
| onion_defs.h | ||
| onion_wire.csv | ||
| peer_wire.c | ||
| peer_wire.csv | ||
| peer_wire.h | ||
| tlvstream.c | ||
| tlvstream.h | ||
| towire.c | ||
| wire.h | ||
| wire_io.c | ||
| wire_io.h | ||
| wire_sync.c | ||
| wire_sync.h | ||