core-lightning/wire
Rusty Russell 5bd3d51131 subds: fix case where we keep retrying on EOF.
Our low-level ccan/io IO routines return three values:
-1: error.
0: call me again, I'm not finished.
1: I'm done, go onto the next thing.

In the last release, we tweaked the sematics of "-1": we now opportunistically
call a routine which returns 0 once more, in case there's more data.  We use errno to
distinguish between "EAGAIN" which means there wasn't any data, and real errors.

However, if the underlying read() returns 0 (which it does when the peer has closed
the other end) the value of errno is UNDEFINED.  If it happens to be EAGAIN, we will
call it again, rather than closing.  This causes us to spin: in particular people reported
hsmd consuming 100% of CPU.

The ccan/io read code handled this by setting errno to 0 in this case, but our own
wire low-level routines *did not*.

Fixes: https://github.com/ElementsProject/lightning/issues/7655
Changelog-Fixed: Fixed intermittant bug where hsmd (particularly, but also lightningd) could use 100% CPU.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-09-13 11:13:53 -07:00
..
test bitcoin/short_channel_id: pass by copy everywhere. 2024-03-20 13:51:48 +10:30
bolt12_wire.csv wire: add new field invreq_paths from spec. 2024-08-01 12:31:48 +09:30
channel_type_wire.csv common/channel_type: wrapper for generated 'struct channel_type'. 2021-09-13 15:53:23 +02:00
extracted_bolt12_01_recurrence.patch wire: add new field invreq_paths from spec. 2024-08-01 12:31:48 +09:30
extracted_onion_02_offers.patch wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support." 2023-09-20 13:56:46 +09:30
extracted_onion_03_onionmsg-payload-as-bytearr.patch wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support." 2023-09-20 13:56:46 +09:30
extracted_onion_05_remove-onion_message.patch wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support." 2023-09-20 13:56:46 +09:30
extracted_peer_04_opt_will_fund.patch wire: fix up messy patches (make extract-peer-csv) 2023-09-20 13:56:46 +09:30
extracted_peer_05_newonion.patch wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support." 2023-09-20 13:56:46 +09:30
extracted_peer_06_funding_outpoint_sigs.patch wire: fix up messy patches (make extract-peer-csv) 2023-09-20 13:56:46 +09:30
extracted_peer_07_peer_storage.patch BOLT: catch up now Dual-funding is included. 2024-05-09 16:14:23 -05:00
extracted_peer_09_quiescence-protocol.patch channeld: allow stfu based on peer features, not EXPERIMENTAL_FEATURES. 2023-05-23 09:34:08 +09:30
extracted_peer_10_upgradable.patch BOLT: catch up now Dual-funding is included. 2024-05-09 16:14:23 -05:00
extracted_peer_11_splice.patch wire: fix up messy patches (make extract-peer-csv) 2023-09-20 13:56:46 +09:30
extracted_peer-shutdown-wrong_funding.patch protocol: add TLV for shutdown message, use 100 as "wrong_funding" outpoint. 2021-03-16 13:08:40 +10:30
fromwire.c common/utils: macros to help get copy/compare across different types right. 2024-07-23 09:54:47 +09:30
Makefile bolt12: allow first_node_id in blinded path to be a scid. 2024-05-12 19:11:43 -05:00
onion_defs.h bolt12: allow first_node_id in blinded path to be a scid. 2024-05-12 19:11:43 -05:00
onion_wire.csv bolt12: allow first_node_id in blinded path to be a scid. 2024-05-12 19:11:43 -05:00
onion_wire.h build: don't generate experimental variants of wire files. 2023-05-23 09:34:08 +09:30
peer_wire.c connectd: do response to gossip queries, don't hand them to gossipd. 2024-07-10 12:21:19 +09:30
peer_wire.csv BOLT: catch up now Dual-funding is included. 2024-05-09 16:14:23 -05:00
peer_wire.h build: don't generate experimental variants of wire files. 2023-05-23 09:34:08 +09:30
tlvstream.c common/wire: update, don't replace fields array in TLV structures. 2024-07-23 09:54:47 +09:30
tlvstream.h common/wire: update, don't replace fields array in TLV structures. 2024-07-23 09:54:47 +09:30
towire.c common/utils: macros to help get copy/compare across different types right. 2024-07-23 09:54:47 +09:30
wire_io.c subds: fix case where we keep retrying on EOF. 2024-09-13 11:13:53 -07:00
wire_io.h connectd: do decryption for peers. 2022-01-20 15:24:06 +10:30
wire_sync.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
wire_sync.h wire_sync_write: support take() 2017-06-27 10:25:53 +09:30
wire.h signed types: add handlers for signed types 2023-07-13 19:34:47 +09:30