shallow-copy DictDB query results #1556
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
db_query()
with default keys pops buffers, and this would result in actually removing the buffers from the record itself. Later calls toget_result()
would then raise a KeyError, which would go unhandled.This PR adds shallow-copy to DictDB results, so that changes to the returned dict are not reflected in the db itself.
The bug revealed a general issue: ZMQStreams are closed when an exception is raised in their
on_recv()
callback (following the IOStream pattern, and on the general principal that a socket with failing handlers should not be allowed to continue), which meant that invoking this bug would prevent any future queries to the Hub. So in addition to fixing the particular bug, a decorator is added that catches and logs exceptions, and is applied to allon_recv()
handlers in IPython.parallel, such that other similar bugs will no longer result in the closure of the socket.Previously failing tests included at the db and client levels.
repro prior to fix: