Page 1 of 1

Debugging

Posted: Tue Jul 17, 2012 12:07 pm
by det0r
Somebody needs to debug the civ server and find the cause of the segmentation fault. I'm moving to Australia in a few weeks and I might have time to look into it once I'm settled in, but that won't be until early October. As far as I know, akfaew is very busy at the moment so he doesn't have time.

So, any volunteers? Maybe somebody can write a nicely worded e-mail to one of the freeciv developers? I assume nobody will be against making the savegame available? The game is over anyway...

Posted: Tue Jul 17, 2012 12:43 pm
by kingofnerds
No, I am not against making the Savegame available to people wanting to determine the cause of the failure... Question, were the Pirates ever removed? Was it determined that the Pirates were definitely related to the cause of the Segfault?

Posted: Tue Jul 17, 2012 10:04 pm
by det0r
kingofnerds wrote:Question, were the Pirates ever removed? Was it determined that the Pirates were definitely related to the cause of the Segfault?
I don't think so. Kevin made a few comments about how pirates are generated in another thread - if somebody wants to compile a server version that has the 'pirate spawning' fixed then that could be a good start. I don't mind playing a game 'with the risk of crashing' if its necessary for play-testing, but it does waste a lot of akfaew's time if he has to keep restarting the server every day.

Posted: Wed Jul 18, 2012 12:46 am
by kevin551
I will repeat my comment from before.
The Freeciv server is not broken - it does not need to be fixed or compiled.

The crash is caused because longturn altered the ruleset.
Last game we altered the file pirates.ruelset in the nations folder to make pirates playable.
The lines changed were
is_playable = 0
barbarian_type = "Sea"

There are two possible fixes
1. Keep pirates and make pirates unplayable by a human player. Add the two lines back into pirates.ruleset
2. Remove pirates from this game.

The problems with the fixes.
1. Changes to the nations folder will affect all games. The code that allows players to choose what nation they want will need to be changed.

2. Removing a nation that cannot be created is potentially problematic. It may not be easy to remove pirates. I don't know. Perhaps someone could test this.

Posted: Wed Jul 18, 2012 7:13 am
by Grendel
Just speculation here...

I don't think removing those two lines are what did it. If the game does not have a barbarian of each type, land and sea, the server crashes at game start with the message:
No land barbarian nation defined. At least one required.
...unless we changed code to circumvent that.

I think the problem may be with the Barbarian nation, as opposed to Pirates. Players had seen pirates, so spawning pirates seems ok. It was T60 when we had first crash, which is default onsetbarbs setting. Maybe game first tried to make land barbs and crashed. Then admin restarted and second time it decided to make pirates. Then exactly ten turns later, it tries to make land barbs again and crashes. I am guessing there is a player playing land barbs and the game can't find a nation to use for land barbs. I seem to recall seeing him on the list, but not sure. There are players signed up for both at any rate.

I think solution would be to edit savegame file and reassign player playing land barbs to another nation or turn off barbarians.

Posted: Wed Jul 18, 2012 7:51 pm
by kingofnerds
Wasn't it a mistake/oversight that barbarians/pirates were enabled in the first place?

Posted: Thu Jul 19, 2012 1:20 pm
by kevin551
The reason the two lines were removed to make pirates and barbarians playable is because of the check you just found.

In file ruleset.c is the check
if (fc_strcasecmp(barb_type, "Sea") == 0) {
if (pnation->is_playable) {
/* We can't allow players to use barbarian nations, barbarians
* may run out of nations */
ruleset_error(LOG_FATAL,
"Nation %s marked both barbarian and playable.",
nation_rule_name(pnation));

This checks to make sure nations marked as sea barbarians are not playable
Hence you cannot make pirates playable unless you also remove the second line. So we removed both. There is no problem starting the server with both lines removed.

Posted: Mon Jul 23, 2012 5:13 am
by kevin551
kingofnerds wrote:Wasn't it a mistake/oversight that barbarians/pirates were enabled in the first place?
Yes. A small mistake at the start has caused a major problem now.

If Grendel is right and it is barbarians causing this problem not pirates then there is an easy fix. Just turn off the creation of barbarians. We can leave the pirates in place.

In future games we just need to remember to disable barbarians/pirates before the start.

Posted: Fri Mar 15, 2013 4:27 am
by kevin551
Too late now - but it appears a patch for the bug that killed this game has now been written. (Note it was written to allow multiple barbarian nations, not to fix our case which was when the server tried to spawn barbarians and there were no nations available - but it fixes both.)

patch #3776: server/barbarian.c:create_barbarian_player fix deficencies patches for the case "If for some reason the pick_a_nation-function returns NULL, the server crashes with segmentation fault. "