Issue 109

This is a work in progress.

The segfault I encountered seems occur when we try to allocate an iterator when there are too many JS call frames on the stack. I assume this is causing Node/V8 to fail some allocations.

Unfortunately this makes it a bit tricky to test. I added an example test which causes the segfault; then I added some code which works around the allocation problems, resulting in a catchable JS Error. However, the test is still problematic, since it seems to cause timeouts, and also causes a segfault in database.close() which I don't understand.