I booted into OS X today and tried running the unit tests for my PHP driver. It chugged away for a while, then gave me “bus error”. Great. Gotta love C error messages. I narrowed it down to when I insert 253 or more elements into MongoDB. Now, that number was suspiciously close to 256, but I couldn’t think why that would be. I tracked it to the encoding code, then to the _id class code, then to the _id generation code. Surprisingly, it was doing its “bus error” thing before any memory access, it was just reading a file. I suddenly realized that I wasn’t closing the file after reading it, fixed it, and it ran perfectly.

Please let me know what thought of this post, anonymously here or in the comments below:
Funny (0) Useful (0) Too short (0) Too long (0)