VM Fail

Work today was full of fail.

It started out with a push-update to my Windows VM from IT. Simple enough, right? Well, this update somehow pushed my VM over the edge of hard drive usage and caused it to start reporting low space errors (the VM thinks it’s a 130GB drive, but it’s located on a 60GB partition, and it had eaten up around 59.7 GB). This meant I could no longer run automated tests in it, which was my primary work for today. Ok, fine, spend some time cleaning up the VM.

This, unfortunately, isn’t enough… since the VM HD files are in 2GB chunks, cleaning up stuff inside the VM and reducing the used HD space down to 26GB doesn’t reduce the VM files’ sizes any. So I attempt a defrag. The available space on the drive very quickly goes down from about 300MB to 110MB, at which point I decide this is a very bad idea and stop.

Spend the morning finding tools to resize the physical drive partitions to give the VM some more room (as it is now running in the 110MB of free space and is generally unusable). Finally fall back to Gparted and discover that the partitions are actually logical volumes, so I have to resize them within the OS. Great.

Spend most of the afternoon figuring out how to boot Ubuntu into a command line as root so I can unmount the appropriate drives to reduce the logical volume size of /home so I can increase the logical volume size of /. (Issues mainly stemming from the fact that all of the physical drive space was already allocated between the two logical volumes, so I needed to reduce one to increase the other, and reductions cannot be done while the partition is mounted.) Discover that I first need to reduce the file system size. Finally succeed at doing so and at giving / an additional 2GB of memory. This was around 4 PM. Success!

Finally get the VM booting back up, and it’s running mostly ok. I then stupidly decide to resize the HD size within Windows so it doesn’t eventually use up the newly allocated 2GB and die again (which is something most of the online conversations on VM sizes I’m finding recommend anyway). This kicks off and starts eating up the newly-allocated 2GB. Eventually, it has 0KB left on its partition, signals an abort, and kills the VM in the middle of the process.

So yeah, now I have a VM in an unbootable state on a partition with 0KB available space (so it can’t boot anyway). Awesome.
I filed a ticket to IT to either get a new VM or get help in adding a VM I have to the corporate domain, but that won’t happen until Monday. Blah. Unfortunately, as there was no VM backup and it was an image of my old Windows workstation, everything I had on there is lost. Oh well.

So yeah, I essentially got nothing done at work today because of stupid VM issues. As soon as I get a new VM working, I’m going to snapshot it and set it to revert to snapshot every shutdown.

Edit: For my own future reference, the relevant commands were:
umount /home
resize2fs /dev/mainvg/home 19609750
lvreduce -L -2G /dev/mainvg/home
mount /home
lvresize -L +2G /dev/mainvg/root
resize2fs /dev/mainvg/root somenumber

plsql fun

Here’s a fun little question for those of you who aren’t experts at plsql…

Given this plsql code

procedure helper_method(
   iChange IN boolean,
   oValue OUT number
) IS
BEGIN
    IF iChange THEN
        oValue := 2;
    END IF;
END helper_method;

procedure do_test(
    oValue OUT number
) IS
BEGIN
    oValue := 1;
    --Checkpoint 0
    helper_method(true, oValue);
    --Checkpoint 1
    helper_method(false, oValue);
    --Checkpoint 2
END do_test;

and this java code (assuming the right frameworks for calling into plsql)

public void doTest() {
    IntOutParam out = new IntOutParam();
    sqlCall("do_test", out);
    System.out.println(out.getInt());
}

what is printed out when you replace the checkpoint comments with a RETURN; statement?
The answer surprised me… I actually stumbled across this at work today and it took me a while to figure out.

Replacing checkpoint 0 with RETURN; prints out 1, as expected.
Replacing checkpoint 1 with RETURN; prints out 2, as expected.
Replacing checkpoint 2 with RETURN; prints out 0. Huh?

Can you spot why and what the fix should be?
Hint: Swapping the order of the true/false calls would result in outputs of 1, 0, and 2 respectively.
Huge Hint: At checkpoint 2, the value of oValue is actually null.
See comments for the solution.

So yeah, now you know something to watch out for when programming in plsql :)

Hiking

We went to Big Basin today and it was a lot of fun.
jgrafton drove (lots and lots of twisty roads, many without lanes) and we (Brian, brewer) hiked an easy trail and took photos. Then we went for tasty burgers for dinner.

I’ll post photos at some point.

Threw in a last minute fix on Friday (logging, to help debug an issue) that it turns out I had forgotten to check for null in one case. Result: shittons of NPEs in the log files, which really, really wasn’t pretty. The only thing that saved me was that someone had had the awesome foresight to wrap the piece of vital code that I was logging in try{}catch(Exception e){}. This meant that, instead of killing the entire request, it only logged an error message and continued on happily. Still not good, but not completely fatal either. Meh.

Fun fun fun fun.

Epic, epic fail

So today I checked in a changelist containing (what I thought were) relatively minor changes to 40 files.
Turns out I had switched two parameters in a function call (so what should have been call(String a, String b) instead was call(String b, String a). If I had run *any* test at all, I would have caught it. But I didn’t, assuming that the changes were simple enough (and I had had someone else look over the code with me and it looked fine to both of us). Result: everything broke, hard.
Took me about 30 minutes to get things back in a happy state (fixing up 40 separate files) and then another 3 hours or so to properly revert out everything.
It was an incredibly dumb thing of me to do (submit any change, even a seemingly minor and trivial one, without testing first).

Also, I managed to rip the green shirt I really like.

I’m so upset with myself :-\

Day of endings

Today was my last day of work at Viz. It was good… got the testing infrastructure started. Did as much as I could given I only had 8 hours to work on it. Managed to get it done after 5.5 (Wednesday plus some of today) and did some final bug fixing and integrating afterwards. Bid farewell to everyone.

Today was our P3 interview, which marked the end of our kernel project. His main criticism was that we used 5 locking primitives in our kernel (mutex, cond [condition variable], icond [internal condition variable], ENTER_CRIT/EXIT_CRIT, and disable_interrupts/enable_interrupts). He said this was indicative of “running away” from problems by creating more locking primitives than figuring out those problems. Yeah, sounds about right. He also found a potential deadlock in our kernel (that, at least, is very very unlikely) and a few problems with the scheduler. Also, one part of our kernel (a function that either copies to/from userspace/kernel space or vice versa depending on where the pointer you pass to it is) was called a 1337 hax and we were told that 1337 hax should be very well documented (whereas ours was lacking any documentation… oops). Also, we generally had bad quality/missing documentation in our kernel. Not surprising, given how we mostly did the documentation in the last 2 days.

Today was our pen-based computing presentation, which marks the end of the pen-based class and also of our adventure game mapping tool project. That went pretty well… we managed to implement all desired features and Carl and Edmund got saving/scrolling working at the last minute. Woo.

Also, today was our P4 late day. We went into it rather confused on why free was causing page faults left and right and wondering if it was a kernel issue. After about 5 hours of debugging (in addition to the debugging yesterday), as I read through the code because I was completely stumped, I discovered the lines:
file_desc* fd_struct;
...
fd_struct = (file_desc*)malloc(sizeof(fd_struct));
...

Oops.
So yeah, the end of OS projects (and our ~7 hour debug issue) and of the semester of workdeath was a stupid typo bug. Whee.

Overall, it’s been a good semester. I think I’ve decided on a job (the one I kinda decided I wanted since the beginning), and I’ll send out the acceptance letter tomorrow (along side my last rejection letter).