gossipd: remove gossmap_fetch_tail.
It only gets called for diagnostics when something goes wrong (and we were going to exit anyway), and it's only useful with mmap (which we now disable on error) but it shouldn't crash: ``` **BROKEN** gossipd: Truncated gossmap record @7991501/7991523 (len 0): waiting **BROKEN** gossipd: FATAL SIGNAL 6 (version v25.09) **BROKEN** gossipd: backtrace: common/daemon.c:41 (send_backtrace) 0x6506817cc529 **BROKEN** gossipd: backtrace: common/daemon.c:78 (crashdump) 0x6506817cc578 **BROKEN** gossipd: backtrace: ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 ((null)) 0x75e8267a032f **BROKEN** gossipd: backtrace: ./nptl/pthread_kill.c:44 (__pthread_kill_implementation) 0x75e8267f9b2c **BROKEN** gossipd: backtrace: ./nptl/pthread_kill.c:78 (__pthread_kill_internal) 0x75e8267f9b2c **BROKEN** gossipd: backtrace: ./nptl/pthread_kill.c:89 (__GI___pthread_kill) 0x75e8267f9b2c **BROKEN** gossipd: backtrace: ../sysdeps/posix/raise.c:26 (__GI_raise) 0x75e8267a027d **BROKEN** gossipd: backtrace: ./stdlib/abort.c:79 (__GI_abort) 0x75e8267838fe **BROKEN** gossipd: backtrace: ./assert/assert.c:96 (__assert_fail_base) 0x75e82678381a **BROKEN** gossipd: backtrace: ./assert/assert.c:105 (__assert_fail) 0x75e826796516 **BROKEN** gossipd: backtrace: common/gossmap.c:111 (map_copy) 0x6506817cea77 **BROKEN** gossipd: backtrace: common/gossmap.c:1870 (gossmap_fetch_tail) 0x6506817d1f93 **BROKEN** gossipd: backtrace: gossipd/gossmap_manage.c:1442 (gossmap_manage_get_gossmap) 0x6506817c45fb **BROKEN** gossipd: backtrace: gossipd/gossmap_manage.c:753 (gossmap_manage_handle_get_txout_reply) 0x6506817c5850 **BROKEN** gossipd: backtrace: gossipd/gossipd.c:574 (recv_req) 0x6506817c172b ``` Reported-by: @grubles Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -1868,17 +1868,3 @@ void gossmap_disable_mmap(struct gossmap *map)
|
||||
munmap(map->mmap, map->map_size);
|
||||
map->mmap = NULL;
|
||||
}
|
||||
|
||||
const u8 *gossmap_fetch_tail(const tal_t *ctx, const struct gossmap *map)
|
||||
{
|
||||
size_t len;
|
||||
u8 *p;
|
||||
|
||||
/* Shouldn't happen... */
|
||||
if (map->map_end > map->map_size)
|
||||
return NULL;
|
||||
len = map->map_size - map->map_end;
|
||||
p = tal_arr(ctx, u8, len);
|
||||
map_copy(map, map->map_size, p, len);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -308,7 +308,4 @@ u64 gossmap_lengths(const struct gossmap *map, u64 *total);
|
||||
|
||||
/* Debugging: connectd wants to enumerate fds */
|
||||
int gossmap_fd(const struct gossmap *map);
|
||||
|
||||
/* Fetch unprocessed part of gossmap */
|
||||
const u8 *gossmap_fetch_tail(const tal_t *ctx, const struct gossmap *map);
|
||||
#endif /* LIGHTNING_COMMON_GOSSMAP_H */
|
||||
|
||||
@@ -1434,20 +1434,15 @@ struct gossmap *gossmap_manage_get_gossmap(struct gossmap_manage *gm)
|
||||
" used=%"PRIu64" seen=%"PRIu64" written=%"PRIu64,
|
||||
map_used, map_size, written_len);
|
||||
} else if (map_size != map_used) {
|
||||
const u8 *remainder_fd, *remainder_mmap;
|
||||
const u8 *remainder_fd;
|
||||
|
||||
/* Sigh. Did gossmap see something different (via mmap)
|
||||
* from what we see via read? It's possible it's caught up
|
||||
* now, but just in case, log BOTH */
|
||||
remainder_mmap = gossmap_fetch_tail(tmpctx, gm->raw_gossmap);
|
||||
remainder_fd = fetch_tail_fd(tmpctx,
|
||||
gossmap_fd(gm->raw_gossmap),
|
||||
map_used, map_size);
|
||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||
"Gossmap failed to process entire gossip_store: "
|
||||
"at %"PRIu64" of %"PRIu64" remaining_mmap=%s remaining_fd=%s",
|
||||
"at %"PRIu64" of %"PRIu64" remaining_fd=%s",
|
||||
map_used, map_size,
|
||||
tal_hex(tmpctx, remainder_mmap),
|
||||
tal_hex(tmpctx, remainder_fd));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user