Actions
Feature #1701
open[proposed] resolved inconsistency in autoworker APIs to avoid memory handling errors
Start date:
10/11/2025
Due date:
% Done:
0%
Estimated time:
Description
[3.3.90.6-dev]
#api_proposal
After experimenting with autoworkers, I ran into the following error, with a comment in gdb describing a double free of a pointer:
Program received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
warning: 44 ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007ffff764527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007ffff76288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007ffff76297b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff77ce8d7 "%s\n") at ../sysdeps/posix/libc_fatal.c:134
#6 0x00007ffff76a8ff5 in malloc_printerr (str=str@entry=0x7ffff77d1bf0 "free(): double free detected in tcache 2")
at ./malloc/malloc.c:5772
#7 0x00007ffff76ab55f in _int_free (av=0x7ffff7803ac0 <main_arena>, p=<optimized out>, have_lock=0) at ./malloc/malloc.c:4541
#8 0x00007ffff76addae in __GI___libc_free (mem=0x555556f8ecc0) at ./malloc/malloc.c:3398
#9 0x00005555557e80d6 in pf_path_destroy (path=path@entry=0x55561a2b3230) at ../../../common/aicore/path_finding.c:3416
#10 0x00005555555a4a54 in auto_worker_findwork (nmap=<optimized out>, pplayer=pplayer@entry=0x555556fd1bb0,
punit=punit@entry=0x5556146927f0, state=state@entry=0x5555dfbbfc60, recursion=recursion@entry=0)
at ../../../server/advisors/autoworkers.c:1153
#11 0x00005555555a5cdc in auto_workers_player (pplayer=pplayer@entry=0x555556fd1bb0) at ../../../server/advisors/autoworkers.c:1369
#12 0x00005555555753f9 in end_phase () at ../../server/srv_main.c:1524
#13 srv_running () at ../../server/srv_main.c:3025
#14 srv_main () at ../../server/srv_main.c:3606
#15 0x000055555556ad4e in main (argc=<optimized out>, argv=0x7fffffffdb88) at ../../server/srv_entrypoint.c:362
(gdb)
Reviewing the offending code, I realized that my confusion was that two of the autoworker APIs worked differently than the third one.
Attached is a recommendation to make all three APIs work consistently with each other. I will take no offence if this issue is closed and rejected..
Files
Actions