Crash Protection

Have an idea or suggestion for features to be included in the upcoming The Major BBS v10? Let us know here
Post Reply
daniel_spain
Posts: 203
Joined: Sun Aug 09, 2020 2:39 am

Crash Protection

Post by daniel_spain »

So years i got i wrote a Tele-Arena stand-alone server just "because" i was teaching myself tcp/ip
development and how servers reacted and handled things and when it was done i didnt release it
i didnt put it online it just sits on my pc and i use it to reference things on occasion since it is
based on the original 5.6d version code for code..... (i know im rambling)
Anyhow...... there used to be this crash that would happen and after weeks of looking i managed to
just write a function that would "catch" the crash and only disconnect that player not the whole
server, i came up with this idea based on a similar idea found in the "RunUO: Ultima Online Emulator"
a .net written open sourced project where one could run their own ultima online servers.
In their instance it would catch the crash, write a FULLY detailed log and reboot.
I went a bit further to catch a crash kill the user connection only and allow the server to proceed as
if nothing happened.

Now onto the post......

Now we know there are 2 types of WorldGroup crashes, "General Protection Fault" and "Exception Error"
most exceptions are bad message file outputs, at least in my experiences, and GP errors are just
bad coding ( (if strlen(i)==1) and i is an int) my request would be the ability to prevent the actual shutdown
of the system in the event it crashed and maybe just crash that node?

Another history flashback.....

Years ago i ported "Forbidden Lands I" and @Kracken played it and near the end of the game some "demon" variable was
causing a crash, i managed to isolate it doing this very thing where when it happened it would write a log and "bbsdsc(usrnum)"
that way my comm terminal would have the exact time it happened and i could read the log file......
Fixed it in less than an hour and he went on to beat the game.

So can it be done? eliminating crashing was my #1 priority when i ported TA because well any sysop would tell you, an invalid teleport
sysop command to crash the whole system was bull$%&^. I fixed it all with syntax checking but in regards to this it would be alot more
involved than that.

Good thing im a systems developer and not a core api developer like @Duckula there.

Just one of the many things as someone who runs a server with on some days 60 people online would love to see done.

Questman
Posts: 79
Joined: Fri Aug 07, 2020 2:12 pm

Re: Crash Protection

Post by Questman »

HA! I have a FL1 and 2 port too - let me know that bug fix and I'll incorporate it :)

But you're absolutely right. In my opinion I think the crash handling was a little lazy. The catastro() routine just dumps the board, forcing a restart. You can set it up so the board auto-restarts but that's still annoying like you said when you have 60 users.

I think your idea is really good. Better to either gracefully recover if that can be detected - or just kill that "session" if possible. The main challenge might be that the user session isn't a true thread, but part of the singular monolith.

daniel_spain
Posts: 203
Joined: Sun Aug 09, 2020 2:39 am

Re: Crash Protection

Post by daniel_spain »

Questman wrote:
> HA! I have a FL1 and 2 port too - let me know that bug fix and I'll
> incorporate it :)
>
> But you're absolutely right. In my opinion I think the crash handling was
> a little lazy. The catastro() routine just dumps the board, forcing a
> restart. You can set it up so the board auto-restarts but that's still
> annoying like you said when you have 60 users.
>
> I think your idea is really good. Better to either gracefully recover if
> that can be detected - or just kill that "session" if possible.
> The main challenge might be that the user session isn't a true thread, but
> part of the singular monolith.

the bug was on me, you can check... not sure of the file but theres a variable called demctr or demon
and it was initialized with an = 0 but when i ported i just declared it without the = 0
i did have to rewrite the entire input handler the way it pocesses commands because in a ported state
the current one did not utilize ALL of the commands, was missing some. Again @Kracken was the testbot.

Kracken
Posts: 46
Joined: Sat Aug 08, 2020 1:12 pm

Re: Crash Protection

Post by Kracken »

daniel_spain wrote:
> So years i got i wrote a Tele-Arena stand-alone server just
> "because" i was teaching myself tcp/ip
> development and how servers reacted and handled things and when it was done
> i didnt release it
> i didnt put it online it just sits on my pc and i use it to reference
> things on occasion since it is
> based on the original 5.6d version code for code..... (i know im rambling)
> Anyhow...... there used to be this crash that would happen and after weeks
> of looking i managed to
> just write a function that would "catch" the crash and only
> disconnect that player not the whole
> server, i came up with this idea based on a similar idea found in the
> "RunUO: Ultima Online Emulator"
> a .net written open sourced project where one could run their own ultima
> online servers.
> In their instance it would catch the crash, write a FULLY detailed log and
> reboot.
> I went a bit further to catch a crash kill the user connection only and
> allow the server to proceed as
> if nothing happened.
>
> Now onto the post......
>
> Now we know there are 2 types of WorldGroup crashes, "General
> Protection Fault" and "Exception Error"
> most exceptions are bad message file outputs, at least in my experiences,
> and GP errors are just
> bad coding ( (if strlen(i)==1) and i is an int) my request would be the
> ability to prevent the actual shutdown
> of the system in the event it crashed and maybe just crash that node?
>
> Another history flashback.....
>
> Years ago i ported "Forbidden Lands I" and @Kracken played it and
> near the end of the game some "demon" variable was
> causing a crash, i managed to isolate it doing this very thing where when
> it happened it would write a log and "bbsdsc(usrnum)"
> that way my comm terminal would have the exact time it happened and i could
> read the log file......
> Fixed it in less than an hour and he went on to beat the game.
>
> So can it be done? eliminating crashing was my #1 priority when i ported TA
> because well any sysop would tell you, an invalid teleport
> sysop command to crash the whole system was bull$%&^. I fixed it all
> with syntax checking but in regards to this it would be alot more
> involved than that.
>
> Good thing im a systems developer and not a core api developer like
> @Duckula there.
>
> Just one of the many things as someone who runs a server with on some days
> 60 people online would love to see done.

Yes actually the "Forbidden Lands 1" was good from A to Z (spent couple weeks playing through, I didn't tested all classes, but the warrior was good enough
and didn't notice anything weird... there was the "jail unlock" rtkick (I would stay trapped :), but I recall you fixed it. That's it.
That game seems to never end, it's just heaving grinding once you reach the God realms.

For the demon, it was "Quest of the Alchemists" (the one I played right after FL1). It would GP.OUT as soon as you trigger the demon to move..
Unfortunately you need to lure him to the final room to win the game so that was a bummer! :D

The fix was to remove the "unsigned" cast to the "demloc" variable in the "demon()" routine (last line). That would clear compiler errors.
After that, I could play to the "congratulation" trigger without incident.
I still remember that one very well, it was very funny and puzzling (scripted the potion mixes heheh). Similar to Fazuul and Zorgon.

Another bummer is "Crossroads of the Elements" that is available on many online BBS. Not a single one works fully in my book... there's a bug that triggers only after level 3 or so where you can't level up any further. Looks good until then... too bad it's well designed.

Yes, unfortunately GP.OUT can't be hard to catch, and IMHO you need to play through the entire game (or at least give it a shot, more than just entering it and look around).
Even moreso with ported modules from one architecture to the other.

Questman
Posts: 79
Joined: Fri Aug 07, 2020 2:12 pm

Re: Crash Protection

Post by Questman »

We can fix XRoads.

Who ported Quest of the Alchemists? I own that, but haven't gotten around to looking at it yet. Does anyone have a WG3 source?

daniel_spain
Posts: 203
Joined: Sun Aug 09, 2020 2:39 am

Re: Crash Protection

Post by daniel_spain »

Questman wrote:
> We can fix XRoads.
>
> Who ported Quest of the Alchemists? I own that, but haven't gotten around
> to looking at it yet. Does anyone have a WG3 source?

I did. got a source from someone the files were GPL*.* I think........ ported it 3 times. first 2 led to crashes, final one worked.
as @Kracken said, he beat it. so I remember marking that one feature complete. he used too play all my ports.

daniel_spain
Posts: 203
Joined: Sun Aug 09, 2020 2:39 am

Re: Crash Protection

Post by daniel_spain »

Questman wrote:
> We can fix XRoads.
>
> Who ported Quest of the Alchemists? I own that, but haven't gotten around
> to looking at it yet. Does anyone have a WG3 source?

Xroads I would love to see on wg3. tried a version once but without any data files to work with it was too much guessing so I quit.
lost a source to quest for zen which really upset me, ported LOST1 and GPLQA and of course the entire entertainment collection even got a source to land of something ir lords of something somewhere. I got an entire folder of ports.
I do it for fun. something about porting the old stuff is quite fun. Sea battle failed because ofd interrupts but the rest went without a hitch.

Kracken
Posts: 46
Joined: Sat Aug 08, 2020 1:12 pm

Re: Crash Protection

Post by Kracken »

daniel_spain wrote:
> Questman wrote:
> > We can fix XRoads.
> >
> > Who ported Quest of the Alchemists? I own that, but haven't gotten around
> > to looking at it yet. Does anyone have a WG3 source?
>
> Xroads I would love to see on wg3. tried a version once but without any data files to
> work with it was too much guessing so I quit.
> lost a source to quest for zen which really upset me, ported LOST1 and GPLQA and of
> course the entire entertainment collection even got a source to land of something ir
> lords of something somewhere. I got an entire folder of ports.
> I do it for fun. something about porting the old stuff is quite fun. Sea battle
> failed because ofd interrupts but the rest went without a hitch.

You might have that last copy left of zen.. :/ hope that hdd doesn't bitrot in the meantime!

For FL1 and GPLQA, they were both stable under DOS. I didn't played throughout the GPLQA WGNT port, but my copy looks fine as of now
(just tested and demon roam normally so thumbs up.

For Xroads, nice, actually salvaging/stabilizing it would be a great RPG to the platform.

Old source, yes, like the quest for magic. Quite a lot of interesting strange and intricate algo... like that array lookup routine working in a divide/conquer
way... they went into such length probably because of cpu/memory optimaztion of the time.
For me it's like archaeology. You never know what's around the corner, most likely the lines of codes dates from 35 years ago, intact, untouched.
"deciphering" such routines can be as much fun as playing the actual game. For QFM, that source was also the ultimate walkthrough to play it completely and throughout.
(I didn't found any walkthrough anyway, unlike Kyrandia/Fazuul). Riddles were impossible to solve otherwise !

Post Reply