Page 1 of 2
Server down.
Posted: Thu 27.09.2007, 21:01
by Hades
Well,
I have encountered the same problem again... I need to delete the server savefile to fix it. But this is a very very severe problem that needs to be fixed. Honestly I'm getting tired of this and if it happens again. I won't be hosting it anymore until a fix is made. No point in running a server if I have to delete the server savefile every week... So i'll do it one more time, after that I don't know what to tell you.
Re: Server down.
Posted: Sat 29.09.2007, 18:32
by Hades
Well,
This is my third time experienceing this same bug... It really needs a fix and there is no point in hosting a server if I have to delete the server savefile every week.
So if you think you can help fix this. Read the topic in
http://www.mangband.org/cgi-bin/yabb/Ya ... 1191010175
If you don't mind playing on a server where I have to delete the server savefile maybe once a week then just post here and I'll put it back up for you. But this is your warning if you want to.
You can not own any houses for if you do if I have to delete the server savefile they will be gone. So just post here if you want it up and I'll put it up. Not worth it if noone wants to play on it.
Hopfully this issue will be resolved soon.
Re: Server down.
Posted: Sun 30.09.2007, 10:28
by PowerWyrm
Did you already delete the server savefile? I think to have an idea of the problem we should do a little experimenting with that server savefile. Since the file is a text file (it's totally readable...), we could do the following:
- save the server savefile somewhere and remove it from the /save directory
- generate a new town
- add the elements of the old savefile one by one until the problem is reproduced
In particular, the following should be investigated:
- <monster_lore>
- <artifacts>
- <stores>
- <parties>
- <dungeon_levels>
- <monsters>
- <objects>
- <houses>
- <wilderness>
- <player_names>
At least, to be able to restart the server without losing the most important information, the <houses> part, seed_flavor and seed_town should be imported from the bugged server savefile.
Re: Server down.
Posted: Sun 30.09.2007, 12:38
by Billsey
While going through save files last night, I found a number of instances in the save code where a s16b number was written using the write_uint() function instead of the write_int() function. Though this doesn't really seem like it would cause problems (you should get 0xFFFFFFFF for dungeon depth at -50', which when read into a s16b is -1) I changed them anyway.
Re: Server down.
Posted: Sun 30.09.2007, 17:26
by Hades
I still have the server savefile yes. I'll do what you say Power and see what turns up. And I don't know much about C/C++ (Just some basic crap) So not sure if I wanna go messing around with what Bill said.
Re: Server down.
Posted: Sun 30.09.2007, 20:50
by Berendol
Why not upload your savefile somewhere, so the experts can give it a peek?
By the way, MAngband is straight C. Go ahead and tweak, but remember to back up things often and change the save AND load routines.
Tip: To alter an existing savefile's structure you should tweak the save function, recompile, run server, close server, tweak the load function, and recompile. By recompile, I mean to simply 'make' the game, don't 'make clean'.
Re: Server down.
Posted: Sun 30.09.2007, 21:15
by Hades
I've uploaded the server savefile onto here.
Geocities wouldn't let me upload it as plain "server" name so I renamed it "server.txt" so it would upload
http://www.geocities.com/thesectt/server.txt
Take a peek...
Thank you Berendol for the suggestion =).
Re: Server down.
Posted: Mon 01.10.2007, 13:20
by PowerWyrm
Ok... toying around with that server savefile, I narrowed the problem to the <stores> section...
Starting from a fresh server savefile and importing everything from the corrupted savefile except the <stores> section works fine. As soon as I put that section back the server crashes or freezes...
The problem must be an item in a shop that the game doesn't like...
More to come...
Re: Server down.
Posted: Mon 01.10.2007, 16:08
by PowerWyrm
Found the problem...
The bug happens when someone sells a random artifact in a shop... when the artifact is removed from the shop, the server freezes/crashes.
I'll take a look at the source code to see what could be the cause...
Re: Server down.
Posted: Mon 01.10.2007, 20:46
by Fink
PW, did this apear to be in your own code, or does it drift into preexisting stuff too?
Re: Server down.
Posted: Tue 02.10.2007, 11:56
by PowerWyrm
Since it concerns random artifacts it doesn't appear in preexisting code.
I made further testing and still couldn't fix the thing. The server simply freezes when a random artifact is sold in a shop... it would require a debug mode to trap the timeout errors. I'll investigate more...
Re: Server down.
Posted: Tue 02.10.2007, 12:47
by Hades
Well,
Knowing this new information I am going to put the server back up, but the random artifacts will be disabled untill a fix is made. I will renew the store section so hopfully your houses will still be there. I don't have an obsurd amount of time to do so now but by tonight PWMAngband will be up without random artifacts.
I will use the original savefile from when the problem first happened. If I still have it not sure if I deleted it or not.
Thanks
Re: Server down.
Posted: Tue 02.10.2007, 15:51
by Berendol
Don't forget about gdb, PowerWyrm! gdb can save your whole week.
I'm very curious to see what happens with this one.
Re: Server down.
Posted: Tue 02.10.2007, 16:02
by PowerWyrm
RAAAAAAAH!
I finally found the stupid bug!!!!
Using the buggy server savefile and putting some debug code, I found that calls to rand_int in the apply_magic function were always yielding a result of 0!!! No wonder why the server froze... for example there was something like
while (rand_int(10)==0) count++;
in that function which resulted in an endless loop.
So I looked for something related to randarts that was damn the RNG up... and I found this marvelous bug in randart.c:
/* Set the RNG seed. */
Rand_value = o_ptr->name3;
Rand_quick = TRUE;
...
/* Restore RNG */
Rand_quick = FALSE;
The problem is that if the RNG was defined as "quick" prior to the call to the randart function, it is erroneously restored!
So I fixed the function as follows:
/* save the RNG */
tmp_seed = Rand_value;
rand_old = Rand_quick;
/* Set the RNG seed. */
Rand_value = o_ptr->name3;
Rand_quick = TRUE;
...
/* Restore RNG */
Rand_value = tmp_seed;
Rand_quick = rand_old;
... and now the server doesn't crash anymore!!!
Re: Server down.
Posted: Tue 02.10.2007, 16:23
by Hades
Awesome, If you wouldn't mind e-mailing it to me I can throw the server back up with randarts enabled =).
Since I still have the stupid pre-compiled version I can't slap the fix in myself hehe.