Re: [Freeciv-Dev] (PR#39582) 2.0.9: crash at end of turn

2008-06-23 Thread Jason Dorje Short

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

Christian Prochaska wrote:

 The crash happens on Windows (GTK+ client) after ending the turn and
 after the server cuts the connection due to lagging player while the
 client is busy for some seconds. When the client detects the lost
 connection (in this case when trying to send data to the server in
 request_new_unit_activity(punit, ACTIVITY_IDLE), called from
 set_unit_focus()) it does some cleanup and switches to the main page.
 But set_unit_focus() still continues after the
 request_new_unit_activity() call and references a now invalid unit pointer:

Interesting.  But...I thought hack connections weren't supposed to be 
cut because of lag?  When I run under valgrind I get:

2: ignoring ping timeout to hack-level connection sjolley from localhost 
(player Stephen Jolley)

many many times.  But the connection is uninterrupted.

 Now I wonder if it's really necessary to take actions on socket write
 errors on the client side at all? Since the request calls to the server
 don't return an immediate result that the client depends on, wouldn't it
 be sufficient if the client would cleanup and reset to pre-game state
 only when reading of server input fails? The attached patch fixed the
 crash and didn't show any problems for me so far.

Possibly an okay workaround.  But, I'd still want to know how exactly 
the punit_focus is getting set to an invalid (freed) pointer.  If it can 
happen here, it could happen again.

-jason



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


Re: [Freeciv-Dev] (PR#39582) 2.0.9: crash at end of turn

2008-06-23 Thread Jason Dorje Short

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

Maybe I miss something, but: your backtrace in this ticket shows the 
crash happening on a successful read, not on a write error.  It also 
shows SDL and GTK code being mixed together, what's up with that?

-jason



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


Re: [Freeciv-Dev] (PR#39582) 2.0.9: crash at end of turn

2008-06-23 Thread Jason Dorje Short

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

Christian Prochaska wrote:

 As I understand it, the read was successful, but while the received data
 is being handled, the connection gets lost, which gets detected when
 trying to send data to the server in request_new_unit_activity(). The
 write error then causes the client to switch to pre-game state, which
 causes the unit pointer to be freed.

Switching to pre-game state in the middle of packet handling seems to be 
a very, very bad idea.

I would think rather that the disconnect should be queued up to be 
handled once current handlers have left.  Failing that, your patch to 
just ignore write errors might be the safest choice.

-jason



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


Re: [Freeciv-Dev] (PR#39582) 2.0.9: crash at end of turn

2008-06-22 Thread Jason Dorje Short

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

Christian Prochaska wrote:

 The 2.0.9 uninstaller deletes only files installed by itself, so the
 savegames should still be where they were stored (by default in the game
 directory - C:\Program Files\Freeciv-2.0.9-gtk2 or C:\Program
 Files\Freeciv-2.0.9-win32). Please look again.

That's a bug right there.  Savegames should be shared across freeciv 
installations (freeciv is generally backward-compatible and mostly 
forward-compatible in loading savegames) so only one savegame directory 
should be needed.

-jason



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


Re: [Freeciv-Dev] (PR#39582) 2.0.9: crash at end of turn

2008-06-22 Thread Jason Dorje Short

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

I can't reproduce the crash here with S2_0.  On loading the game and 
ending turn a time or two, the game ends.  What client is used to get 
the crash and what is necessary to do other than just end turn?

-jason



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