Bug 477803

Summary: cannot create city - lost connection to server?
Product: [Fedora] Fedora Reporter: Pavol Šimo <palo.simo>
Component: freecivAssignee: Brian Pepple <bdpepple>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: 10CC: bdpepple, chris.snook, galtgendo, ismael, kyrian, mgress, pahan, sacntct, swarren
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: 2.1.9-1.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-15 17:59:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavol Šimo 2008-12-23 19:45:32 UTC
Description of problem:
After starting single player game when trying to build a new city the client returns to the first screen. Message at the bottom says "Lost connection to server!"

Version-Release number of selected component (if applicable):
freeciv-2.1.8-1.fc10.i386

How reproducible:
always

Steps to Reproduce:
1. start single player game
2. use settlers unit to build a city (press b key)
3. confirm the suggested city name
  
Actual results:
client returned to first screen

Expected results:
the city is built

Additional info:
freeciv-2.1.6-1.fc9.i386.rpm works just fine (have no other .rpm available)

Comment 1 Ismael Olea 2008-12-26 19:47:55 UTC
- launch: $ civserver -d 3
- launch: $ civclient
- you connect with the local civ server.
- create a city, and you'll got a debug log from civserver like this:

3: got packet type=(PACKET_CITY_NAME_SUGGESTION_REQ)35 len=6
3: sending packet type=PACKET_PROCESSING_STARTED(0) len=3
3: handle_city_name_suggest_req(unit_pos=(42,47))
3: Suggesting city name for Hasdrubal Barca at (42,47)
3: sending packet type=PACKET_CITY_NAME_SUGGESTION_INFO(36) len=15
3: sending packet type=PACKET_PROCESSING_FINISHED(1) len=3
> 
3: got packet type=(PACKET_UNIT_BUILD_CITY)53 len=15
3: sending packet type=PACKET_PROCESSING_STARTED(0) len=3
3: sending packet type=PACKET_TILE_INFO(14) len=13
3: sending packet type=PACKET_TILE_INFO(14) len=17
3: sending packet type=PACKET_TILE_INFO(14) len=13
3: sending packet type=PACKET_TILE_INFO(14) len=24
3: last message repeated 2 times
3: sending packet type=PACKET_TILE_INFO(14) len=13
3: last message repeated 2 times
3: last message repeated 2 times (total 4 repeats)
3: last message repeated 3 times (total 7 repeats)
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
3: Warning: calloc with size 0 at line 576 of cm.c
3: Warning: calloc with size 0 at line 577 of cm.c
civserver: cityturn.c:276: auto_arrange_workers: Assertion `cmr.found_a_valid' failed.

Comment 2 Andrea Santilli 2009-02-04 06:58:06 UTC
I can confirm this bug too. After one or two turns the server crashes leaving this message:
> civserver: cityturn.c:276: auto_arrange_workers: Assertion `cmr.found_a_valid' failed.

It looks like it's a gcc bug introduced with version 4.3.2. Please take a look at this thread: http://www.mail-archive.com/freeciv-dev@gna.org/msg06102.html

Comment 3 Andrea Santilli 2009-02-04 06:59:53 UTC
oops i wanted to say it was present with versions 4.2.x and got *fixed* in 4.3.2

Comment 4 Stephen Warren 2009-02-08 18:48:59 UTC
As far as I can tell from the upstream freeciv bug report:

http://bugs.freeciv.org/Ticket/Display.html?id=40610

This can be fixed by compiling with -O1 instead of -O2. Can the package be rebuilt this way, please?

Comment 5 Stephen Warren 2009-02-08 20:29:35 UTC
The following diff to freeciv.spec did seem to make it work. It's probably a hacky way of doing what's required though.

cvs diff: Diffing .
Index: freeciv.spec
===================================================================
RCS file: /cvs/pkgs/rpms/freeciv/F-10/freeciv.spec,v
retrieving revision 1.42
diff -u -p -r1.42 freeciv.spec
--- freeciv.spec	4 Dec 2008 20:31:52 -0000	1.42
+++ freeciv.spec	8 Feb 2009 20:28:46 -0000
@@ -44,8 +44,8 @@ in order to become the leader of the gre
 
 
 %build
-%configure --enable-client=gtk
-make %{?_smp_mflags}
+%configure --enable-client=gtk CFLAGS="-O0"
+make %{?_smp_mflags} CFLAGS="-O0"
 
 
 %install
cvs diff: Diffing common

Comment 6 mark gress 2009-02-12 15:59:11 UTC
I too am having this problem with 2.1.8.  Building a city crashes back to the opening screen.

"Lost connection to server!"

Yum reports no updates for anything.(I'm fully up to date)

Comment 7 Chris Snook 2009-02-14 23:09:00 UTC
-O0 is overkill.  -O1 is sufficient.  Given how slow freeciv gets late in a large game, even on a beefy system, we should be optimizing as much as we can get away with.

Comment 8 Rafał Mużyło 2009-02-17 22:04:34 UTC
While I don't use a RedHat derivate, I found that
gcc 4.3.3 with -O2 leads to a broken freeciv
same gcc with '-O2 -fno-inline-small-functions' doesn't seem to crash
freeciv in the same situation

Comment 9 Kev 'Kyrian' Green 2009-02-27 13:59:16 UTC
Same problem here, although I don't create a city on my first turn so the problem only seems to show up when my opponents create theirs on their first turn.

Hence the game is completely unusable.

A gdb backtrace attached to the server process looks as though exactly the same thing is happening, hence filing here instead of a separate bug.

Program received signal SIGABRT, Aborted.
0x00663416 in __kernel_vsyscall ()
(gdb) bt
#0  0x00663416 in __kernel_vsyscall ()
#1  0x4e1a5460 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x4e1a6e28 in abort () at abort.c:88
#3  0x4e19e40e in __assert_fail (assertion=0x8165360 "cmr.found_a_valid", 
    file=0x81652e7 "cityturn.c", line=276, 
    function=0x8165591 "auto_arrange_workers") at assert.c:78
#4  0x080715f8 in auto_arrange_workers (pcity=0x966d898) at cityturn.c:276
#5  0x0806e360 in create_city (pplayer=0x82acb14, ptile=0x961269c, 
    name=0x9471688 "Lobamba") at citytools.c:1039
#6  0x080a7678 in city_build (pplayer=0x82acb14, punit=0x96732f8, 
    name=0x9471688 "Lobamba") at unithand.c:555
#7  0x080a3e0e in ai_do_build_city () at settlers.c:94
#8  auto_settler_findwork (pplayer=0x82acb14, punit=0x96732f8, 
    state=0xbffb6800, recursion=1) at settlers.c:1031
#9  0x080a3893 in auto_settler_findwork (pplayer=0x82acb14, punit=0x96732f8, 
    state=0xbffb6800, recursion=0) at settlers.c:1158
#10 0x080a419e in auto_settlers_player (pplayer=0x82acb14) at settlers.c:1296
#11 0x0805341d in end_phase () at srv_main.c:786
#12 srv_running () at srv_main.c:1878
#13 srv_main () at srv_main.c:2211
#14 0x0804a8f5 in main (argc=8, argv=0xbffbe314) at civserver.c:258
(gdb)

Comment 10 Pavel Alexeev 2009-04-05 16:54:31 UTC
I also confirm this bug. Game absoluteley unused with it!

Comment 11 Chris Snook 2009-04-05 19:38:17 UTC
Until we get a rebuild with -fno-inline-small-functions or -O1, I suggest that suffering i386 freeciv users use the 2.1.6 build, which doesn't have this problem:

http://kojipkgs.fedoraproject.org/packages/freeciv/2.1.6/1.fc10/i386/freeciv-2.1.6-1.fc10.i386.rpm

Comment 12 Rafał Mużyło 2009-04-05 20:10:47 UTC
OK, there are three important things:
1. this seems to be a gcc bug, but freeciv upstream is
unable to provide a testcase for gcc
2. -fno-guess-branch-probability works as well as
-fno-inline-small-functions did
3. while upstream was unable to create a testcase, 
it has found a workaround (it's in svn and probably in
freeciv 2.1.9 too)

Though it would be nice, if a testcase was created.

Comment 13 Brian Pepple 2009-04-05 20:19:48 UTC
This bug has been fixed in 2.1.9, and will be available in testing in a few days.

Comment 14 Rafał Mużyło 2009-04-05 20:40:00 UTC
(In reply to comment #13)
> This bug has been fixed in 2.1.9, and will be available in testing in a few
> days.  

I'd say "worked around" is better way of putting it -
if the problem really lied in gcc, freeciv couldn't
actually fix it.

Comment 15 Fedora Update System 2009-04-06 02:28:27 UTC
freeciv-2.1.9-1.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/freeciv-2.1.9-1.fc10

Comment 16 Fedora Update System 2009-04-06 20:29:26 UTC
freeciv-2.1.9-1.fc10 has been pushed to the Fedora 10 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update freeciv'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-3349

Comment 17 Pavel Alexeev 2009-04-13 12:26:07 UTC
I able create city! Yes!

Very-very thank you, boys!

Comment 18 Fedora Update System 2009-04-15 17:59:45 UTC
freeciv-2.1.9-1.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.