don't hide io.EOF - wrap errors higher up
move locking to the DB level