Friday, April 19, 2013
Summary
You know, a few months ago, I thought the universe liked me...what with letting me pursue my dream project, giving me lots of very kind supporters, and so on. Today, having been drilled into the ground with the spillage from yesterday's serialization bugs, topped off with a brand new multithreading problem, plus a side-order of poor performance on my other machine, I am beginning to suspect otherwise. Sorry, I don't mean to depress anyone, because, as you will see, this story has a happy ending. But, as with many stories, the middle was much less happy than the ending
I took about three more hours after yesterday's dev log to whip serialization into shape and evict the bugs. I can't remember the last time I had to debug something for that long
Thankfully, things seem to be working quite well now. I threw in quicksave / quickload buttons to really stress-test the engine, and have been saving and loading to me heart's content, so far without problems. But that was just the beginning. My ignorant bliss would not last the morning.
So, we've all heard of crashes. Everyone loves crashes. The thing about crashes - well, the thing about non-parallel crashes - is that they are generally triggered by something. You try to access a piece of memory that doesn't exist, and the greatly-beloved Sir Segfault comes to greet you. You double-delete something, and your debugger opens and complains about political corruption (or was it heap corruption? I forget). Very simple to understand, right?
But what if I told you...that there was a type of error that was just
so much more fun than that? What if I told you that instead of triggering a problem, you could trigger
a small chance of a problem!!! Wouldn't that be so much cooler? Think about it. Instead of just crashing, you could have, say, a 10% chance of crashing! Now, the great and lovely thing about this, is that if you were to, say, make a change that caused this wondrous type of error, you might not even realize or have to deal with it for another hour...day...maybe even week, if you get lucky! Yeah!! Welcome to multithreading. The world in which you're never safe. You tested your program 9 times and it worked? Yay! It's fixed! And then it crashes on the 10th. Very exciting
But wait!!! There's more!!! Order now, and we'll give you two nefarious side-effects for the price of one!! Introducing...the deadlock! A deadlock is not like a crash - a deadlock has much better manners. It does not notify you that your program has failed. It doesn't kill the program, or do anything, really. That's what it does. Nothing. And that's what your program does when it's in deadlock - nothing. And believe me when I say, there's nothing more confusing than nothing! When your computer does nothing, it's hard to tell whether it's doing nothing because there's nothing to do, or if it's trying to do something, but actually doing nothing. In deadlock, it's the latter - your program is doing nothing, because two somethings have collided to make nothing. Make sense?
The best way I can explain deadlock is to relate to a case very relevant to most males in the world: you say "where do you want to go to dinner?" And she says "wherever you want to go." So naturally, you say, "but I want to go wherever you want to go." You are now in deadlock. You're waiting to find out where she wants to go, but she's waiting to find out where you want to go. If you both hold your ground, you'll get to spend an eternity not eating. Now, imagine that two threads within a program want to go out to dinner together. If they are as indecisive as I am, they may have a problem. And the result of this, is that your program does nothing for eternity, because two threads can't decide what they want to eat. Sad, right? Should have gone for the microwave meals
Sheesh, I'm not sure how I got so sidetracked in this log, but I do need to be a little more entertaining from time to time. Needless to say, deadlock took up a lot of my day, as it is remarkably hard to debug (especially a deadlock in system code, which is what I had to contend with today). I have no idea why the problem wasn't showing up on my laptop...I've been running fine on it for ages, but things went terribly wrong when I tried it on the desktop today. Makes me scared to think what will happen when the prototype rolls out
I imagine the debugging pain has only just begun...
Anyway, at this point, all of these nasty errors are solved, and I've finished just about everything I wanted to finish..so I'm going to spend some time playtesting + tweaking/tuning things to try to squeeze more "fun factor" out of the prototype, and then it'll be ready to go! It sure has been a rough ride this week, but I think I can see the end approaching
Thanks for your patience!!!
Hour Tally
Business: 1.42
Coding: 8.74
Internet: 2.01
Testing: 3.34
Thinking: 0.44
Total Logged Time: 15.95