brozzler
brozzler copied to clipboard
RethinkDB code might ignore write errors
I've been looking at brozzler's codebase and I see a lot of direct writes to RethinkDB (e.g. https://github.com/internetarchive/brozzler/blob/master/brozzler/model.py#L119). That would be fine, but RethinkDB has weird behaviour regarding errors: https://rethinkdb.com/api/python/insert/
Basically, if an error occurs, RethinkDB will only throw an exception if it's unrelated to writes (e.g. the query is malformed). If there's an I/O error, the 'errors' field in the return value will be greater than 0, but no exception will be raised.
It's an awful default IMO, and there's an open issue about it in RethinkDB's repository (https://github.com/rethinkdb/rethinkdb/issues/3440). My concern is that it might be possible for a write to not go through and brozzler wouldn't know. Is there protection against this in the codebase?
Brozzler seems to use a custom RethinkDB wrapper (doublethink), but I don't see any checks on the errors
field. Some of the code in Brozzler does check the inserted
and replaced
fields, but not all of it.
If I'm wrong about this, please let me know!