dai_auto_settler_run() gets stuck in recursion which somehow later leads to segfaults
Which kind of action enablers for the city founding the ruleset has?
In general that ai settler code seems unprepared for action enablers controlled city founding, but I have not yet analyzed it in more detail.
Reply To cazfi
Which kind of action enablers for the city founding the ruleset has? In general that ai settler code seems unprepared for action enablers controlled city founding, but I have not yet analyzed it in more detail.
I do not know the ruleset that was used, but 80% of our singleplayer games choose classic rules. Still, that leaves a chance that it's another ruleset. Our mp2 actionenablers for those are 3, and look as follows:
actionenabler_build_city_pioneer action = "Found City" actor_reqs =
target_reqs =
actionenabler_build_city_domestic action = "Found City" actor_reqs =
actionenabler_build_city_fort action = "Found City" actor_reqs =
In addition, Andreas seems to have added more debug info into stack trace and here's another one (getting several of these every day from singleplayers, even though only 0.25% of total games get it.)
debugging using libthread_db enabled Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by /home/freeciv/freeciv/bin/freeciv-web --debug 1 --port 60 38 --Announce none --e'. Program terminated with signal SIGSEGV, Segmentation fault. #0 unit_transported (pcargo=pcargo@entry=0x556131b41a60)
2450 || (!is_server() && pcargo->client.transported_by != -1)) { thread is 1 (Thread 0x7f2f0fb19800 (LWP 6367)) #0 unit_transported (pcargo=pcargo@entry=0x556131b41a60)
---Type <return> to continue, or q <return> to quit--- #1 0x000055612afead4d in package_unit (packet=0x7ffe989df070,
#2 send_unit_info (dest=0x55612d291510, dest@entry=0x0,
#3 0x000055612b0b1d2f in illegal_action (pplayer=0x55612e5105a0,
#4 0x000055612b0b3a0e in unit_perform_action (pplayer=0x55612e5105a0,
#5 0x000055612b0b85bb in unit_do_action ()
#6 0x000055612b10f9c7 in dai_do_build_city (punit=0x556131b41a60,
#7 dai_auto_settler_run (ait=ait@entry=0x55612b745220 <ai_types>,
#8 0x000055612b10f8ea in dai_auto_settler_run ( ...thousands more of these dai_auto_settler_run come after....
P.S. is there a trick to make these messages have more readable formatting? Sorry for not knowing it.
Well there's a clue, in mp2 rules, we do not have any reqs caring about if the cargo is transported, so I'm guessing it's one of the bundled rulesets tripping over the actionenabler req for cargo can't be transported?
Another clue, I have so far never seen this crash in a longturn game which uses our rules. So if it's actionenabler and it's tripping in the checking for unit transported, it's all adding up to cause suspicion for checking this actionenabler req of not being transported, probably.
Yeah, basically almost any non-standard requirement for those action enablers could cause that crash. The code is not prepared for such additional restrictions.
While waiting for a proper fix, you may need to just stop the recursion (remove the recursive call). That probably leads some AI settlers to never to do anything, but it's better than crashing.
Well maybe it's opposite, and the fact we allow settling while still transported. Can I get a clue what I should do next to find it?
Reply To lexxie9952
one of the bundled rulesets tripping over the actionenabler req for cargo can't be transported?
Which ruleset is that? I don't see it in classic or civ2civ3.
Reply To lexxie9952
Well maybe it's opposite, and the fact we allow settling while still transported.
No. The recursion happens when settling is *disallowed* when the code assumes it to be allowed.
instead of stop recursion and do nothing, is there a little less ugly hack like make it decide to deboard somewhere or do something else?
Reply To lexxie9952
: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: Ramiro I: Failed to build city at (63, 31). Reason id: 34
What is that "reason 34" (which ANEK_... is the 34) in your sources?
Reply To cazfi
Reply To lexxie9952
: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: Ramiro I: Failed to build city at (63, 31). Reason id: 34
What is that "reason 34" (which ANEK_... is the 34) in your sources?
This is connected to several bits of info to know about it...
This line here:
This log here: : in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: Ramiro I: Failed to build city at (63, 31). Reason id: 34 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: Ramiro I: Failed to build city at (64, 31). Reason id: 34 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 2 times 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 2 times (total 4 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 4 times (total 8 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 8 times (total 16 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 16 times (total 32 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 32 times (total 64 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 64 times (total 128 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 128 times (total 256 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 256 times (total 512 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 512 times (total 1024 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 1024 times (total 2048 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 2048 times (total 4096 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 4096 times (total 8192 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 8192 times (total 16384 repeats) 1: in dai_do_build_city() [../../../freeciv/ai/default/aisettler.c::1273]: last message repeated 16384 times (total 32768 repeats)
This stack trace here: Core was generated by /home/freeciv/freeciv/bin/freeciv-web --debug 1 --port 60 83 --Announce none --e'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000056436a5ce510 in can_player_see_unit () #0 0x000056436a5ce510 in can_player_see_unit () #1 0x000056436a3d4f70 in send_unit_info () #2 0x000056436a49bdbf in illegal_action () #3 0x000056436a49da9e in unit_perform_action () #4 0x000056436a4a264b in unit_do_action () ---Type <return> to continue, or q <return> to quit--- #5 0x000056436a4f9a57 in dai_auto_settler_run () #6 0x000056436a4f997a in dai_auto_settler_run () #7 0x000056436a4f997a in dai_auto_settler_run () #8 0x000056436a4f997a in dai_auto_settler_run () #9 0x000056436a4f997a in dai_auto_settler_run () #10 0x000056436a4f997a in dai_auto_settler_run () #11 0x000056436a4f997a in dai_auto_settler_run () #12 0x000056436a4f997a in dai_auto_settler_run () #13 0x000056436a4f997a in dai_auto_settler_run () #14 0x000056436a4f997a in dai_auto_settler_run () #15 0x000056436a4f997a in dai_auto_settler_run () #16 0x000056436a4f997a in dai_auto_settler_run () #17 0x000056436a4f997a in dai_auto_settler_run () ...etc... 32751 more times....