Closed
Description
I've lately noticed that attempting to exit Codex will print:
➜ nim-codex git:(master) ✗ ./build/codex --data-dir=./codex-data
...
NTC 2025-03-12 11:13:43.390-03:00 Shutting down after having received SIGINT topics="codex" tid=48666
NTC 2025-03-12 11:13:43.390-03:00 Stopping codex node topics="codex node" tid=48666
NTC 2025-03-12 11:13:43.393-03:00 Stopping Codex topics="codex" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
INF 2025-03-12 11:13:45.775-03:00 Exiting blockexc task runner topics="codex blockexcengine" tid=48666
NTC 2025-03-12 11:13:45.775-03:00 REST service stopped tid=48666 address=127.0.0.1:8080
INF 2025-03-12 11:13:45.776-03:00 Exiting advertise task loop topics="codex discoveryengine advertiser" tid=48666
NTC 2025-03-12 11:13:45.776-03:00 Exited codex topics="codex" tid=48666
and then hang. Insisting on the SIGTERM will print:
^CNTC 2025-03-12 11:15:04.702-03:00 Shutting down after having received SIGINT topics="codex" tid=48666
NTC 2025-03-12 11:15:04.702-03:00 Stopping codex node topics="codex node" tid=48666
NTC 2025-03-12 11:15:04.702-03:00 REST service stopped tid=48666 address=127.0.0.1:8080
WRN 2025-03-12 11:15:04.702-03:00 service is already stopped topics="libp2p switch" tid=48666
WRN 2025-03-12 11:15:04.702-03:00 TCP transport already stopped topics="libp2p tcptransport" tid=48666
WRN 2025-03-12 11:15:04.703-03:00 Failed to stop NAT port mapping renewal thread topics="nat" tid=48666 exc="/home/giuliano/Work/Status/nim-codex/vendor/nim-taskpools/taskpools/instrumentation/contracts.nim(91, 15) `\nworkerContext.currentTask.task.isRootTask()` \n Contract violated for pre-condition at taskpools.nim:394\n workerContext.currentTask.task.isRootTask()\n The following values are contrary to expectations:\n workerContext.currentTask.task.isRootTask() [Worker 0 on taskpool 0x0000616a041f6ac0]\n"
and hang again. I sometimes have to pkill codex
to get it to quit. If I run codex with codex --nat:none
, then the problem doesn't manifest itself. That taken together with the log above suggests this is related to NAT.