This is probably a stupid question....

Posted by Videl on Sun 04 Jun 2006 06:39 AM — 9 posts, 31,311 views.

#0
I am just learning to code because I resently started my own mud and got tired of waiting on my coder...So...I was wondering a good place to find Smaug based snippets...the main one i need is an anti crash snippet. Heard there was one floating out there SOMEWHERE...

Thanks
Videl
USA #1
What does an anti-crash snippet do? Prevent your MUD from crashing? Sounds like magic to me... :-P

Could you maybe provide more details on what exactly this snippet is supposed to do?

Here are two good snippet sites:

http://www.afkmud.com/downloads.php
http://www.mudconnect.com/resources/Mud_Resources:Mud_Code_and_Snippets.html
USA #2
I get around a lot, and I've never heard of this.

If you're getting crashes, we'll be happy to help fix them.
USA #3
You forgot the best snippet site, www.mudbytes.net :)

Samson had one that lets you send your mud a shutdown signal if the server is going down, but I don't know of any snippets that do anti-crash.. though I know ResortMUD has some sort of crash protection in it, I think it basically just saves the world in the event of a crash like doing a hotboot would.
USA #4
Snippet sites:

www.mudbytes.net
www.afkmud.com/downloads.php

Anti-crash? No such animal. There is only code which can manage what happens when one comes up. The sane ones take the form of code that does a controlled save of player data and nothing more. The insane ones try to do stupid stuff like save EVERYTHING before then causing a hotboot. However, the sanity in trusting that much data once the memory has been corrupted is questionable.

If a "no-crash" system is really what you want, then you may as well find one that will handle SIGSEGV and restart the game_loop without rebooting, hotbooting, or whatever. But even that's not entirely reliable.

Best bet? Let it crash and diagnose the cause. Masking bugs is not the way to go.
USA #5
I would tend to agree with Samson. Leaving bugs and feeling "safe" because of an "anti-crash" handler will just create bugs that will bite you in the behind later on. It's better to find and fix them early.

Don't forget that a crash-handler can only detect when a crash occurs after the bug that caused that crash. So whatever screwed up your memory, program stack or whatever will still be around. As Samson pointed out it's not necessarily a good idea to trust the data in memory after a crash signal is received.
#6
What I was talking about is a system a friend's mud had. It hotbooted whenever the mud was about to crash and he simply fixed the error when he got on. It also logged what caused the crash so he knew what to fix.
USA #7
That's still a crash. The MUD just doesn't go down. You still lose world data if not saved.
USA #8
I don't know how much harder it can be stressed that any kind of copyover to handle a crash situation is just plain crazy. There is no way in hell I would ever recommend doing such a thing because you can seriously corrupt data by relying on it under those conditions.

Frankly I think your friend was playing with fire by doing that. There's just no other way around it. Let the mud crash. As long as your startup script is functioning, it will reboot. It may be a minor pain for the players, but they'll thank you later for not letting their data get corrupted.