Bug Fixes (single zmq context, timeout in database connection)

Simultaneous access to a row when writing and reading will cause an exception. This allows the proces to wait until it's available and then write instead.
think this was the cause for the too many sockets error?