PANIC save/autosave Lua API

Bug #573178 reported by Mitch
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
Unassigned

Bug Description

bzr5285 ./build_and_run.sh
ubuntu 64 lucid
single player
Map : Comet Island
Game Type : Tribes together
[game type : autocrat works ok]

if i click save.. or when the first auto save happens

 Writing Waredata Data ... done!
 Writing Bobdata Data ... done!
 Writing Node Ownership Data ... done!
 Writing Exploration Data ... done!
 Writing Players Unseen Data ... done!
 Writing Scripting Data ... nwritten: 11471
done!
 Writing Objective Data ... done!
 Game: Writing Map Data done!
Game: Writing Player Economies Info ... done
Game: Writing Command Queue Data ... PANIC: unprotected error in call to Lua API (Attempt to persist a C function)

Mitch (mitchix-gmail)
summary: - Segfault on save/autosave Lua API
+ PANIC save/autosave Lua API
Revision history for this message
Chuck Wilder (chuckw20) wrote :

I've encountered the same or similar crashes when running under Ubuntu 9.10, most notably when hosting a multi-player game with 3-4 AI players.

Revision history for this message
SirVer (sirver) wrote :

This is a heisebug I am very eager to kill. I've seen it a few times before and I found one way to trigger it and fixes it in r5288. Please try with this revision.

Also, I would be most graceful to know a way to reproduce this; maybe a savegame shortly before it happens could also help.

Changed in widelands:
status: New → Incomplete
importance: Undecided → High
assignee: nobody → SirVer (sirver)
milestone: none → build16-rc1
Revision history for this message
SirVer (sirver) wrote :

I found the problem with this. The pairs() and ipairs() functions return a c closure that continues the iteration. As there is a sleep() inside the for iteration, the save will always occur while we are inside the iteration. short code to reproduce the crash:

function blah()
  for i,v in ipairs{1} do sleep(300) end
end

this will crash at any save. I currently do not see a way around this besides reimplementing pairs() and ipairs() in pure lua (which I am not sure if this works) and overriding the default c functions or adding a warning to the documentations (very risky) or completely disabling ipairs and pairs (which suckz, because iterating an array becomes difficult, iterating a dictionary practically impossible).

Changed in widelands:
status: Incomplete → Confirmed
Revision history for this message
SirVer (sirver) wrote :

Fixed this sucker in a portable and clear way. I had to special case ipairs() and pairs() in the persistence process, but as we only support lua 5.1 at the moment this is not tragic.

I very much enjoyed this debug over two languages. I also vaded through the lua library source code which is very pleasant and straightforward to read.

However, please try again with latest revision.

Changed in widelands:
status: Confirmed → Fix Committed
Revision history for this message
Mitch (mitchix-gmail) wrote : Re: [Bug 573178] Re: PANIC save/autosave Lua API

Ok I will pull code tonight again compile and post results.. glad you had
fun tracking it down

On May 3, 2010 2:16 PM, "SirVer" <email address hidden> wrote:

Fixed this sucker in a portable and clear way. I had to special case
ipairs() and pairs() in the persistence process, but as we only support
lua 5.1 at the moment this is not tragic.

I very much enjoyed this debug over two languages. I also vaded through
the lua library source code which is very pleasant and straightforward
to read.

However, please try again with latest revision.

** Changed in: widelands
      Status: Confirmed => Fix Committed

--
PANIC save/autosave Lua API
https://bugs.launchpad.net/bugs/573178
You received this bug notifi...
Status in Widelands: Fix Committed

Bug description:
bzr5285 ./build_and_run.sh
ubuntu 64 lucid
single player
Map : Comet Island
Game ...

Revision history for this message
Mitch (mitchix-gmail) wrote :

Build r5296 (never could get 5288 to pull) build and ran fine on ubuntu 64 lucid ./build_and_run.sh

single player game
map: Comet Island
Game Type: Tribes together
manual save worked and auto-save worked
for me issue resolved thank you very much... [will work on your 500,000 in small unmarked paypal transactions ;)]
great game...

SirVer (sirver)
Changed in widelands:
assignee: SirVer (sirver) → nobody
Revision history for this message
SirVer (sirver) wrote :

Released in build16-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.