Project

General

Profile

Bug #858214

Ghost units seen, packhand assertion failure (2.6.1+, various clients)

Added by Chippo Elder 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Server
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

If you load the attached savegame in any client and press Turn Done, you'll see the following in the console:

chippo@chippo-Aspire-V3-731:~$ freeciv-qt-26 -F
2: Loading tileset "amplio2".
2: Loading tileset "delta2".
2: Loading tileset "amplio2".
2: Loading tileset "amplio2".
1: 0x61200048cac0 1991 Settlers at (54,126) Tokugawa Ieyasu
0: in handle_tile_info() [packhand.c::2947]: assertion '0 unit_list_size(ptile->units)' failed.
0: Ghost units seen
0: Please report this message at https://www.hostedredmine.com/projects/freeciv
Aborted
chippo@chippo-Aspire-V3-731:~$ freeciv-gtk3.22-26 -F
2: Loading tileset "amplio2".
2: Loading tileset "delta2".
2: Loading tileset "amplio2".
2: Loading tileset "amplio2".
1: 0x6120001996c0 1991 Settlers at (54,126) Tokugawa Ieyasu
0: in handle_tile_info() [packhand.c::2947]: assertion '0 unit_list_size(ptile->units)' failed.
0: Ghost units seen
0: Please report this message at https://www.hostedredmine.com/projects/freeciv
Aborted

Strangely, I'm not getting a core dump. I'm running with -F, ulimit -c is unlimited... must be some interaction with ASAN or something. So no BT, but since it happens every time, you can try this at home.


Related issues

Has duplicate Freeciv - Bug #847413: Visibility of units loading without moving is not updatedClosed

History

#1 Updated by Chippo Elder 5 months ago

ASAN was, for unknown reasons, preventing a core dump. Without ASAN and with gcc, it behaves the same on that savegame, but now I get a core.

(gdb) bt full
#0 raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
set = {__val = {0, 139665639218336, 0, 140730297286480, 140730297296821, 94354921019136, 7, 47244640256, 0, 10305103598584205568, 94354921020704, 0, 21474836480, 140730297286512, 140728898420736, 94354921020512}}
pid = <optimized out>
tid = <optimized out>
#1 0x000055d0b6379617 in fc_assert_fail
(file=file@entry=0x55d0b63b5b24 "packhand.c", function=function@entry=0x55d0b63b7c00 <__FUNCTION__.31602> "handle_tile_info", line=line@entry=2947, assertion=assertion@entry=0x55d0b63b6ba0 "0 == unit_list_size(ptile->units)", message=message@entry=0x55d0b63b5e55 "Ghost units seen") at log.c:523
level = LOG_FATAL
#2 0x000055d0b618ce10 in handle_tile_info (packet=packet@entry=0x55d0befb9ec0) at packhand.c:2985
new_known = TILE_KNOWN_UNSEEN
old_known = TILE_KNOWN_SEEN
known_changed = <optimized out>
tile_changed = <optimized out>
powner = <optimized out>
eowner = <optimized out>
presource = <optimized out>
pterrain = <optimized out>
ptile = <optimized out>
FUNCTION = "handle_tile_info"
#3 0x000055d0b6192f73 in client_handle_packet (type=type@entry=PACKET_TILE_INFO, packet=packet@entry=0x55d0befb9ec0) at packhand_gen.c:59
#4 0x000055d0b614a44f in client_packet_input (packet=packet@entry=0x55d0befb9ec0, type=15) at client_main.c:770
FUNCTION = "client_packet_input"
#5 0x000055d0b6152593 in input_from_server (fd=fd@entry=41) at clinet.c:416
type = PACKET_TILE_INFO
packet = 0x55d0befb9ec0
nb = <optimized out>
FUNCTION = "input_from_server"
#6 0x000055d0b6208f9d in fc_client::server_input(int) (this=0x55d0b7d58a60, sock=41) at fc_client.cpp:462
#7 0x00007f0671b805c8 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8 0x00007f0671b8d135 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9 0x00007f0671b8d491 in QSocketNotifier::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007f06713a0a86 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#11 0x00007f06713a9e00 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#12 0x00007f0671b54a9a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007f0671bad305 in () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007f066f1dd84d in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007f066f1ddad0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007f066f1ddb73 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00007f0671bac6a5 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007f0671b5363b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007f0671b5b3a6 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x000055d0b62092ce in fc_client::fc_main(QApplication*) (this=0x55d0b7d58a60, qapp=0x55d0b794da90) at fc_client.cpp:257
#21 0x000055d0b60d239b in qtg_ui_main(int, char**) (argc=<optimized out>, argv=<optimized out>) at gui_main.cpp:191
qpm = <optimized out>
--Type <RET> for more, q to quit, c to continue without paging--c
app_icon = {d = 0x55d0b7c822b0}
#22 0x000055d0b614ac43 in client_main (argc=1, argv=0x7ffe53610f48) at client_main.c:685
i = 2
loglevel = LOG_NORMAL
ui_options = <optimized out>
ui_separator = <optimized out>
option = <optimized out>
fatal_assertions = 6
aii = 1
FUNCTION = "client_main"
#23 0x00007f0670cf01e3 in __libc_start_main (main=0x55d0b60cfc20 <main(int, char**)>, argc=2, argv=0x7ffe53610f48, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe53610f38) at ../csu/libc-start.c:308
result = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 3700874178623776520, 94354895867824, 140730297290560, 0, 0, 7422477281803183880, 7417895462520694536}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x7ffe53610f60, 0x7f0672a72190}, data = {prev = 0x0, cleanup = 0x0, canceltype = 1398869856}}}
not_first_call = <optimized out>
#24 0x000055d0b60d0fde in _start () at gui_main.cpp:114

#2 Updated by Marko Lindqvist 5 months ago

  • Category set to Server

This kind of ghost unit issues are typically bugs in the server-side. It either sends units that it should not send, or does not send unit removal when it should.

#3 Updated by Marko Lindqvist 5 months ago

In the previous turn our Galleon sees the Japanese Settler id 1991 (that will turn to a ghost unit) and Trireme on the River tile on Japanese coast. At turn change our Galleon moves away.
Taking Japanese we can see that Settler 1991 has been loaded to the Trireme, and both of them have moved to the sea.

I don't know which happens first, and thus should hide the Settlers, moving of our Galleon away, or loading of the Settler to the Trireme.

#4 Updated by Marko Lindqvist 5 months ago

I suspect the problem being in that unit is not removed when it's loaded. Following is the backtrace taken when unit_transport_load_send() is called for unit 1991.

Breakpoint 1, unit_transport_load_send (punit=0x55555784ea70, ptrans=0x555557851710)
at ../../../src/server/unittools.c:2923
2923 unit_transport_load(punit, ptrans, FALSE);
(gdb) bt
#0 unit_transport_load_send (punit=0x55555784ea70, ptrans=0x555557851710)
at ../../../src/server/unittools.c:2923
#1 0x0000555555659a68 in handle_unit_load (pplayer=pplayer@entry=0x5555576021a0,
cargo_id=<optimized out>, trans_id=<optimized out>, ttile_idx=<optimized out>)
at ../../../src/server/unithand.c:3380
#2 0x00005555556863f6 in aiferry_gobyboat (ait=ait@entry=0x555555975da0 <ai_types>,
pplayer=pplayer@entry=0x5555576021a0, punit=punit@entry=0x55555784ea70,
dest_tile=dest_tile@entry=0x5555584a45c0, with_bodyguard=with_bodyguard@entry=false)
at ../../../../src/ai/default/aiferry.c:830
#3 0x0000555555692ebf in dai_gothere (ait=ait@entry=0x555555975da0 <ai_types>,
pplayer=pplayer@entry=0x5555576021a0, punit=punit@entry=0x55555784ea70,
dest_tile=dest_tile@entry=0x5555584a45c0) at ../../../../src/ai/default/aitools.c:281
#4 0x000055555568f140 in dai_auto_settler_run (ait=<optimized out>, pplayer=0x5555576021a0,
punit=<optimized out>, state=0x555556579080) at ../../../../src/ai/default/aisettler.c:1043
#5 0x00005555555c4cd1 in auto_settlers_player (pplayer=pplayer@entry=0x5555576021a0)
at ../../../../src/server/advisors/autosettlers.c:1162
#6 0x0000555555599358 in end_phase () at ../../../src/server/srv_main.c:1297
#7 srv_running () at ../../../src/server/srv_main.c:2830
#8 srv_main () at ../../../src/server/srv_main.c:3371
#9 0x000055555558e5e3 in main (argc=3, argv=0x7fffffffe068) at ../../../src/server/civserver.c:476

#5 Updated by Marko Lindqvist 5 months ago

  • Status changed from New to In Progress
  • Assignee set to Marko Lindqvist
  • Target version set to 2.6.2

Unit can go out of sight when it moves. Usually that catches also unit loading, as it happens as the side effect of unit moving to the transport. But when unit loads to a transport on the same tile, there is no movement involved. Usually that happens within ones own city where other players don't see inside to begin with, but here the settler was loading to a trireme in the open (on a river tile).

#7 Updated by Chippo Elder 5 months ago

You still get an unusual message on the console:

1: 0x61200048d9c0 1991 Settlers at (54,126) Tokugawa Ieyasu

But the message about ghosts is gone and so is the assert failure.

#8 Updated by Marko Lindqvist 5 months ago

Chippo Elder wrote:

You still get an unusual message on the console:

1: 0x61200048d9c0 1991 Settlers at (54,126) Tokugawa Ieyasu

You shouldn't, and I don't.

#9 Updated by Chippo Elder 5 months ago

Maybe that message is coming from a debug build which I'm also testing. Changing too many things at the same time...

#10 Updated by Chippo Elder 5 months ago

Now I must be going mad.

I do:

make clean
git pull

This give me 2.6.1+ (modified ec0f40dcfb). I have 3 locally applied patches:

diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp
index 0901b432a0..b2017cac08 100644
--- a/client/gui-qt/dialogs.cpp
+++ b/client/gui-qt/dialogs.cpp
@@ -976,10 +976,15 @@ void notify_goto::inspect_city()
 void races_dialog::nationset_changed(int index)
 {
   QString rule_name;
-  char *rn;
+  QByteArray rn_bytes;
+  const char *rn;
   struct option *poption = optset_option_by_name(server_optset, "nationset");
+
   rule_name = qnation_set->currentData().toString();
-  rn = rule_name.toLocal8Bit().data();
+  rn_bytes = rule_name.toLocal8Bit(); /* Hold QByteArray in a variable to
+                                       * extend its, and data() buffer's,
+                                       * lifetime */
+  rn = rn_bytes.data();
   if (nation_set_by_setting_value(option_str_get(poption))
       != nation_set_by_rule_name(rn)) {
     option_str_set(poption, rn);
diff --git a/client/update_queue.c b/client/update_queue.c
index dd56b82b74..26a0da6790 100644
--- a/client/update_queue.c
+++ b/client/update_queue.c
@@ -40,6 +40,7 @@
 #include "client_main.h" 
 #include "connectdlg_common.h" 
 #include "options.h" 
+#include "tilespec.h" 
 #include "zoom.h" 

 #include "update_queue.h" 
@@ -302,7 +303,7 @@ static void update_unqueue(void *data)
     return;
   }

-  if (update_queue_is_frozen()) {
+  if (update_queue_is_frozen() || !tileset_is_fully_loaded()) {
     /* Cannot update now, let's add it again. */
     update_queue_has_idle_callback = FALSE;
     return;
diff --git a/server/unittools.c b/server/unittools.c
index 481231308a..9eb377825b 100644
--- a/server/unittools.c
+++ b/server/unittools.c
@@ -2913,11 +2913,27 @@ static bool unit_enter_hut(struct unit *punit)
 ****************************************************************************/
 void unit_transport_load_send(struct unit *punit, struct unit *ptrans)
 {
+  bv_player can_see_unit;
+
   fc_assert_ret(punit != NULL);
   fc_assert_ret(ptrans != NULL);

+  BV_CLR_ALL(can_see_unit);
+  players_iterate(pplayer) {
+    if (can_player_see_unit(pplayer, punit)) {
+      BV_SET(can_see_unit, player_index(pplayer));
+    }
+  } players_iterate_end;
+
   unit_transport_load(punit, ptrans, FALSE);

+  players_iterate(pplayer) {
+    if (BV_ISSET(can_see_unit, player_index(pplayer))
+        && !can_player_see_unit(pplayer, punit)) {
+      unit_goes_out_of_sight(pplayer, punit);
+    }
+  } players_iterate_end;
+
   send_unit_info(NULL, punit);
   send_unit_info(NULL, ptrans);
 }

That's what I think I should have. So then I go through the sequence:

./autogen.sh
ASAN_OPTIONS="detect_leaks=0" CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -fno-omit-frame-pointer -O1 -fno-optimize-sibling-calls -g -fPIE" CXXFLAGS="$CFLAGS" ./configure --enable-client=all --enable-gitrev --disable-silent-rules --program-suffix=-26 --enable-debug=yes
make -j2
sudo make install

I run the gtk client with -F parameter, load the savegame in this ticket, press Turn Done and on the console I see:

chippo@chippo-Aspire-V3-731:~$ ASAN_OPTIONS="abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1" freeciv-gtk3.22-26 -F
Encodings: Data=UTF-8, Local=UTF-8, Internal=UTF-8
2: Loading tileset "amplio2".
2: Loading tileset "delta2".
2: Loading tileset "amplio2".
2: Loading tileset "amplio2".
1: 0x61200020d040 1991 Settlers at (54,126) Tokugawa Ieyasu
2: Backtrace:
2:     0: freeciv-gtk3.22-26(backtrace+0x5b) [0x4a3b6b]
2:     1: freeciv-gtk3.22-26(backtrace_print+0x112) [0x8ac052]
2:     2: freeciv-gtk3.22-26() [0x8abebb]
2:     3: freeciv-gtk3.22-26(vdo_log+0x138) [0x8b6578]
2:     4: freeciv-gtk3.22-26(do_log+0x19d) [0x8b635d]
2:     5: freeciv-gtk3.22-26(handle_tile_info+0xbd3) [0x5dc7f3]
2:     6: freeciv-gtk3.22-26(client_handle_packet+0x919) [0x5e8dc9]
2:     7: freeciv-gtk3.22-26(client_packet_input+0x43) [0x564453]
2:     8: freeciv-gtk3.22-26(input_from_server+0x154) [0x56fee4]
2:     9: freeciv-gtk3.22-26() [0x519aa0]
2:    10: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7fa62c97771e]
2:    11: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x51ad0) [0x7fa62c977ad0]
2:    12: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x83) [0x7fa62c977dc3]
2:    13: /usr/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_main+0x7d) [0x7fa62d1b6c2d]
2:    14: freeciv-gtk3.22-26(ui_main+0x6b4) [0x515254]
2:    15: freeciv-gtk3.22-26(client_main+0x194a) [0x563c8a]
2:    16: freeciv-gtk3.22-26(main+0x9) [0x514b99]
2:    17: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fa62c70c1e3]
2:    18: freeciv-gtk3.22-26(_start+0x2e) [0x46c83e]
0: in handle_tile_info() [packhand.c::2947]: assertion '0 == unit_list_size(ptile->units)' failed.
2: Backtrace:
2:     0: freeciv-gtk3.22-26(backtrace+0x5b) [0x4a3b6b]
2:     1: freeciv-gtk3.22-26(backtrace_print+0x112) [0x8ac052]
2:     2: freeciv-gtk3.22-26() [0x8abebb]
2:     3: freeciv-gtk3.22-26(vdo_log+0x138) [0x8b6578]
2:     4: freeciv-gtk3.22-26(do_log+0x19d) [0x8b635d]
2:     5: freeciv-gtk3.22-26(fc_assert_fail+0x146) [0x8b6726]
2:     6: freeciv-gtk3.22-26(handle_tile_info+0xcaf) [0x5dc8cf]
2:     7: freeciv-gtk3.22-26(client_handle_packet+0x919) [0x5e8dc9]
2:     8: freeciv-gtk3.22-26(client_packet_input+0x43) [0x564453]
2:     9: freeciv-gtk3.22-26(input_from_server+0x154) [0x56fee4]
2:    10: freeciv-gtk3.22-26() [0x519aa0]
2:    11: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7fa62c97771e]
2:    12: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x51ad0) [0x7fa62c977ad0]
2:    13: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x83) [0x7fa62c977dc3]
2:    14: /usr/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_main+0x7d) [0x7fa62d1b6c2d]
2:    15: freeciv-gtk3.22-26(ui_main+0x6b4) [0x515254]
2:    16: freeciv-gtk3.22-26(client_main+0x194a) [0x563c8a]
2:    17: freeciv-gtk3.22-26(main+0x9) [0x514b99]
2:    18: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fa62c70c1e3]
2:    19: freeciv-gtk3.22-26(_start+0x2e) [0x46c83e]
0: Ghost units seen
2: Backtrace:
2:     0: freeciv-gtk3.22-26(backtrace+0x5b) [0x4a3b6b]
2:     1: freeciv-gtk3.22-26(backtrace_print+0x112) [0x8ac052]
2:     2: freeciv-gtk3.22-26() [0x8abebb]
2:     3: freeciv-gtk3.22-26(vdo_log+0x138) [0x8b6578]
2:     4: freeciv-gtk3.22-26(fc_assert_fail+0x1e8) [0x8b67c8]
2:     5: freeciv-gtk3.22-26(handle_tile_info+0xcaf) [0x5dc8cf]
2:     6: freeciv-gtk3.22-26(client_handle_packet+0x919) [0x5e8dc9]
2:     7: freeciv-gtk3.22-26(client_packet_input+0x43) [0x564453]
2:     8: freeciv-gtk3.22-26(input_from_server+0x154) [0x56fee4]
2:     9: freeciv-gtk3.22-26() [0x519aa0]
2:    10: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7fa62c97771e]
2:    11: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x51ad0) [0x7fa62c977ad0]
2:    12: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x83) [0x7fa62c977dc3]
2:    13: /usr/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_main+0x7d) [0x7fa62d1b6c2d]
2:    14: freeciv-gtk3.22-26(ui_main+0x6b4) [0x515254]
2:    15: freeciv-gtk3.22-26(client_main+0x194a) [0x563c8a]
2:    16: freeciv-gtk3.22-26(main+0x9) [0x514b99]
2:    17: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fa62c70c1e3]
2:    18: freeciv-gtk3.22-26(_start+0x2e) [0x46c83e]
0: Please report this message at https://www.hostedredmine.com/projects/freeciv
2: Backtrace:
2:     0: freeciv-gtk3.22-26(backtrace+0x5b) [0x4a3b6b]
2:     1: freeciv-gtk3.22-26(backtrace_print+0x112) [0x8ac052]
2:     2: freeciv-gtk3.22-26() [0x8abebb]
2:     3: freeciv-gtk3.22-26(vdo_log+0x138) [0x8b6578]
2:     4: freeciv-gtk3.22-26(do_log+0x19d) [0x8b635d]
2:     5: freeciv-gtk3.22-26(fc_assert_fail+0x243) [0x8b6823]
2:     6: freeciv-gtk3.22-26(handle_tile_info+0xcaf) [0x5dc8cf]
2:     7: freeciv-gtk3.22-26(client_handle_packet+0x919) [0x5e8dc9]
2:     8: freeciv-gtk3.22-26(client_packet_input+0x43) [0x564453]
2:     9: freeciv-gtk3.22-26(input_from_server+0x154) [0x56fee4]
2:    10: freeciv-gtk3.22-26() [0x519aa0]
2:    11: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x14e) [0x7fa62c97771e]
2:    12: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x51ad0) [0x7fa62c977ad0]
2:    13: /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_loop_run+0x83) [0x7fa62c977dc3]
2:    14: /usr/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_main+0x7d) [0x7fa62d1b6c2d]
2:    15: freeciv-gtk3.22-26(ui_main+0x6b4) [0x515254]
2:    16: freeciv-gtk3.22-26(client_main+0x194a) [0x563c8a]
2:    17: freeciv-gtk3.22-26(main+0x9) [0x514b99]
2:    18: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7fa62c70c1e3]
2:    19: freeciv-gtk3.22-26(_start+0x2e) [0x46c83e]
Aborted (core dumped)

I've no idea what I was doing when I reported everything fixed. Or whether I'm doing something wrong now. Or what? But continuing, of course there's a core, so:

Core was generated by `freeciv-gtk3.22-26 -F'.
Program terminated with signal SIGABRT, Aborted.
#0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
50    ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7fa6295f5240 (LWP 671069))]
(gdb) bt full
#0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
        set = 
            {__val = {0, 0, 0, 0, 4607182418800017408, 0, 4607182418800017408, 0, 0, 0, 105690555242288, 0, 21474836480, 140735353549584, 140733193388032, 105759274701376}}
        pid = <optimized out>
        tid = <optimized out>
#1  0x00000000008b6836 in fc_assert_fail (file=<optimized out>, function=<optimized out>, line=<optimized out>, assertion=<optimized out>, message=<optimized out>)
    at log.c:523
        level = LOG_FATAL
#2  0x00000000005dc8cf in handle_tile_info (packet=<optimized out>) at packhand.c:2947
        tile_changed = true
        known_changed = false
        powner = <optimized out>
        eowner = 0x0
        presource = 0x7c7
        pterrain = <optimized out>
        ptile = 0x7fa62519e7e8
        old_known = <optimized out>
        new_known = TILE_KNOWN_UNSEEN
#3  0x00000000005e8dc9 in client_handle_packet (type=PACKET_TILE_INFO, packet=<optimized out>) at packhand_gen.c:59
#4  0x0000000000564453 in client_packet_input (packet=0x7fff80c17320, type=15) at client_main.c:770
#5  0x000000000056fee4 in input_from_server (fd=<optimized out>) at clinet.c:416
        type = 2160161568
        packet = 0x60d000432990
        nb = <optimized out>
#6  0x0000000000519aa0 in get_net_input (source=<optimized out>, condition=<optimized out>, data=<optimized out>) at gui_main.c:2105
#7  0x00007fa62c97771e in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007fa62c977ad0 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007fa62c977dc3 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007fa62d1b6c2d in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x0000000000515254 in ui_main (argc=<optimized out>, argv=<optimized out>) at gui_main.c:1880
        sig = <optimized out>
        toplevel_font_name = <optimized out>
#12 0x0000000000563c8a in client_main (argc=1, argv=<optimized out>) at client_main.c:685
        loglevel = <optimized out>
        fatal_assertions = <optimized out>
        option = <optimized out>
        ui_separator = <optimized out>
        ui_options = 0
        aii = 1
        i = <optimized out>
#13 0x0000000000514b99 in main (argc=2, argv=0x7fff80c17320) at gui_main.c:1657

#11 Updated by Marko Lindqvist 5 months ago

The fix is in server side. Likely your client is not picking up correct (rebuilt) server to run, but runs some older build.
And indeed you are using configure option --program-suffix, which I think won't work (-> I'll open a new ticket about that). Client does not launch the server by the name your new build has.
If your goal is to have multiple builds in parallel, use --prefix configure option. By using it, parallel versions of data files also gets installed. Also, when you set --prefix inside your home directory (or any other place where you have write permissions) you don't need to use 'sudo' when installing, removing the risk that your system gets completely broken by buggy freeciv install process.
Also, freeciv mostly works (localization does not work) out of build directory with no need to make install, if you launch it using ./fcgui and ./fcser wrapper scripts.

#12 Updated by Chippo Elder 5 months ago

That is all really really helpful advice. Thank you.

And you are correct. I have been trying to have multiple versions simultaneously installed, with more and less success. Confusion did happen and it has caused me to mal-report in tickets.

And knowing, now, how to run out of the build directory (./fcgui) means I can have as many consistent installed versions as I've got diskspace for. Yay!

But back to the issue of this ticket.

I start with a new directory.

git clone https://github.com/freeciv/freeciv.git
cd freeciv
git pull --all
git checkout S2_6

At this point, I would like to apply all three of those patches, but they don't apply, probably because one of them has already made it onto git. So, just apply the one about ghosts:

git apply ../0005-Fix-ghost-unit-issue-when-unit-is-loaded-to-an-trans.patch

Check where we are at.

$ git diff
diff --git a/server/unittools.c b/server/unittools.c
index 481231308a..9eb377825b 100644
--- a/server/unittools.c
+++ b/server/unittools.c
@@ -2913,11 +2913,27 @@ static bool unit_enter_hut(struct unit *punit)
 ****************************************************************************/
 void unit_transport_load_send(struct unit *punit, struct unit *ptrans)
 {
+  bv_player can_see_unit;
+
   fc_assert_ret(punit != NULL);
   fc_assert_ret(ptrans != NULL);

+  BV_CLR_ALL(can_see_unit);
+  players_iterate(pplayer) {
+    if (can_player_see_unit(pplayer, punit)) {
+      BV_SET(can_see_unit, player_index(pplayer));
+    }
+  } players_iterate_end;
+
   unit_transport_load(punit, ptrans, FALSE);

+  players_iterate(pplayer) {
+    if (BV_ISSET(can_see_unit, player_index(pplayer))
+        && !can_player_see_unit(pplayer, punit)) {
+      unit_goes_out_of_sight(pplayer, punit);
+    }
+  } players_iterate_end;
+
   send_unit_info(NULL, punit);
   send_unit_info(NULL, ptrans);
 }

So then

make clean
./autogen.sh
./configure --enable-client=qt,gtk3.22 --enable-gitrev --disable-silent-rules --enable-debug=some
make -j2
./fcgui

It brings up the gtk3.22 gui. How do I ask fcgui to launch to qt client?

I go and load the ghost savegame, and it bombs out with the assert and ghosts are yet again seen.

chippo@chippo-Aspire-V3-731:~/Downloads/freeciv-26$ ./fcgui 
Unable to find client executable: freeciv
Searching for freeciv clients ...
... using ./client/freeciv-gtk3.22
Running ./client/freeciv-gtk3.22
2: Loading tileset "amplio2".
2: Loading tileset "delta2".
2: Loading tileset "amplio2".
2: Loading tileset "amplio2".
1: 0x55795d15bbc0 1991 Settlers at (54,126) Tokugawa Ieyasu
1: in handle_tile_info() [packhand.c::2947]: assertion '0 == unit_list_size(ptile->units)' failed.
1: Ghost units seen
1: Please report this message at https://www.hostedredmine.com/projects/freeciv

What's wrong with my recipe?

#13 Updated by Marko Lindqvist 5 months ago

Sorry, I forgot to mention one additional complication.

For security reasons, current directory is not part of the path client uses when searching for the server binary to launch in regular build. This limitation is lifted in --enable-debug builds.
Either build with --enable-debug, or install (with custom --prefix, as discussed earlier)

You can also test by running server manually, and using "Connect to Network Game" with host: "localhost" in the client.

#14 Updated by Chippo Elder 5 months ago

OK, confirmed.

The patch 0005-Fix-ghost-unit-issue-when-unit-is-loaded-to-an-trans.patch fixes this Ghost units issue. Commit the patch.

Marko Lindqvist wrote:

This limitation is lifted in --enable-debug builds.
Either build with --enable-debug, or install (with custom --prefix, as discussed earlier)

You mean with --enable-debug=yes or --enable-debug=checks. All my builds had at least --enable-debug=some (to avoid the evil -fomit-frame-pointer pulled in by --enable-debug=no) and this obviously does not lift the security limitation.

#15 Updated by Marko Lindqvist 5 months ago

  • Status changed from Resolved to Closed

#16 Updated by Jacob Nevins 5 months ago

  • Related to Bug #847413: Visibility of units loading without moving is not updated added

#17 Updated by Jacob Nevins 5 months ago

  • Related to deleted (Bug #847413: Visibility of units loading without moving is not updated)

#18 Updated by Jacob Nevins 5 months ago

  • Has duplicate Bug #847413: Visibility of units loading without moving is not updated added

Also available in: Atom PDF