Re: [Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-06-15 Thread Marko Lindqvist

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

2008/3/29 Marko Lindqvist:

 On 24/03/2008, Marko Lindqvist wrote:

   With #40166 fixing server crash, scenario load now ends to client
  crash.

  Actually, this is not limited to scenario load. Same happens quite
 often for any savegame load. (scenario load crashes always, otherwise
 I don't know exact limitations to reproducibility) Loading savegame
 via commandline parameter -f - or otherwise before client connects -
 might be required for crash to happen.

 After long debugging sessions I found out reason for guaranteed scenario crash.

 Scenario games miss thawing of tile send, meaning that no tiles is
ever (not even for another game) sent from server after scenario load.


 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c	2008-06-11 00:33:46.0 +0300
+++ freeciv/server/savegame.c	2008-06-16 07:23:50.0 +0300
@@ -223,6 +223,8 @@
 static void set_savegame_special(bv_special *specials,
 		char ch, const enum tile_special_type *index);
 
+static void game_load_internal(struct section_file *file);
+
 /***
 This returns an ascii hex value of the given half-byte of the binary
 integer. See ascii_hex2bin().
@@ -3746,6 +3748,20 @@
 ***/
 void game_load(struct section_file *file)
 {
+  bool was_send_city_suppressed = send_city_suppression(TRUE);
+  bool was_send_tile_suppressed = send_tile_suppression(TRUE);
+
+  game_load_internal(file);
+
+  send_tile_suppression(was_send_tile_suppressed);
+  send_city_suppression(was_send_city_suppressed);
+}
+
+/***
+  Real game_load function.
+***/
+static void game_load_internal(struct section_file *file)
+{
   int i, k;
   enum server_states tmp_server_state;
   RANDOM_STATE rstate;
@@ -3753,8 +3769,6 @@
   int improvement_order_size = 0;
   int technology_order_size = 0;
   int civstyle = 0;
-  bool was_send_city_suppressed = send_city_suppression(TRUE);
-  bool was_send_tile_suppressed = send_tile_suppression(TRUE);
   char **improvement_order = NULL;
   char **technology_order = NULL;
   enum tile_special_type *special_order = NULL;
@@ -4437,9 +4451,6 @@
   if (!game.info.is_new_game) {
 set_myrand_state(rstate);
   }
-
-  send_tile_suppression(was_send_tile_suppressed);
-  send_city_suppression(was_send_city_suppressed);
 }
 
 /***
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-04-10 Thread Ulrik Sverdrup

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

Hello Marko and Pepeto

Ticket #40083 seems to have more info
http://bugs.freeciv.org/Ticket/Display.html?id=40083

Even though it curiously predates the server-side fix? I can at least
reproduce the backtrace there with curren trunk.

When it crashes, the server is still up, so you can connect back to it
and it won't crash. There you'll see that every single player is set
to AI, that's why the explorer moves as soon as the game starts.

The linked ticket also gives another clue: hagworld aka earth
medium/classic won't crash but all the others do.

The reason is of course that hagworld is in a different format, just
grep server_state in the scenarios:

data/scenario/british-isles-85x80-v2.80.sav:server_state=0
data/scenario/earth-160x90-v2.sav:server_state=0
data/scenario/earth-80x50-v2.sav:server_state=0
data/scenario/europe-200x100-v2.sav:server_state=0
data/scenario/hagworld-120x60-v1.2.sav:server_state=2
data/scenario/iberian-peninsula-136x100-v1.0.sav:server_state=0
data/scenario/tutorial.sav:server_state=0

That is about as much of a clue I have. It seems this issue is pretty tricky

Regards
Ulrik



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-04-10 Thread Marko Lindqvist

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

On 10/04/2008, Ulrik Sverdrup wrote:
  data/scenario/hagworld-120x60-v1.2.sav:server_state=2

 This means that hargworld is not scenario at all (in the Freeciv
internal terminology)

  That is about as much of a clue I have. It seems this issue is pretty tricky

 I think there's several bugs involved. All players being set under AI
is no way restricted to scenario games. Not sending enough information
for detached players is second problem.

 It seems that main bug here is that (correct) rulesets are not sent
when loading scenario game. Sending of rulesets was recently reduced,
and I'm afraid it took away some necessary sends:
 1. Long time ago rulesets were loaded and sent when game started. At
this point we know which rulesets game is going to use, so we can send
*correct* rulesets.
 2. At some point another ruleset loading was added to server start
and rulesets were sent to client when they connect. I'm not aware of
the exact reasons for this change. Presumably there was some problems
when server/client had no rulesets at all. This uses default ruleset,
which often is correct one but not always. I call these rulesets
*dummies*
 3. It seems that recent change took away sending of the *correct*
rulesets (When that  change was discussed, I assumed it would take
away sending of the dummies)


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-03-29 Thread Marko Lindqvist

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

On 24/03/2008, Marko Lindqvist wrote:

   With #40166 fixing server crash, scenario load now ends to client
  crash.

 Actually, this is not limited to scenario load. Same happens quite
often for any savegame load. (scenario load crashes always, otherwise
I don't know exact limitations to reproducibility) Loading savegame
via commandline parameter -f - or otherwise before client connects -
might be required for crash to happen.


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-03-29 Thread Pepeto _

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

 [EMAIL PROTECTED] - Sam. Mar. 29 10:01:13 2008]:
 
 On 24/03/2008, Marko Lindqvist wrote:
 
With #40166 fixing server crash, scenario load now ends to client
   crash.
 
  Actually, this is not limited to scenario load. Same happens quite
 often for any savegame load. (scenario load crashes always, otherwise
 I don't know exact limitations to reproducibility) Loading savegame
 via commandline parameter -f - or otherwise before client connects -
 might be required for crash to happen.
 
 
  - ML
 
 
 

It seems linked with the new code that forbid partially detached
connections, doesn't it?

Else, as I reported long time ago, loading game when many players are
connected to the server make the gtk client crashing. If you have
patience to read and understand PR#39615, patches for many problems with 
gtk connection list are available in PR#39614. Enjoy


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-03-29 Thread Marko Lindqvist

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

On 29/03/2008, Pepeto _  wrote:

 It seems linked with the new code that forbid partially detached
  connections, doesn't it?

 You type faster than I do :-)

 ...

 Uh. I'm not too sure if rearranged sequences of ruleset loads, game
initializations and ruleset sends work correctly for scenario load.
However, current crash is more likely related to handling of the
initial connection.
 Basically: Only already attached client has access to information
required in the process to attach (at least without huge rewrites in
other parts of the code)


 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40167) Client crash on scenario load

2008-03-24 Thread Marko Lindqvist

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

 With #40166 fixing server crash, scenario load now ends to client
crash. Once I enter game, there's only explorer unit visible on
otherwise black screen. It moves around (autoexplore in the beginning
of the first turn?) and then client segfaults in somewhat random
portion of code (but there seems to be invalid terrain pointer always
involved)

 ... just quick check ...

 All tiles seem to have NULL terrain and resource.



 - ML



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev