This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch sam/pushing-fix in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c50d64d903d1322733544eb86d730426af4a0812 Author: Sam Thursfield <[email protected]> AuthorDate: Tue Jul 3 23:44:44 2018 +0200 _artifactcache/pushreceive.py: Avoid premature 'done' messages Code exists in OSTreePusher.needed_commits() to raise a PushExistsException() if the local commit (what we want to push) is not a descendent of the remote commit (what the artifact cache has). Code also exists in OSTreePusher.run() to ignore this exception, unless there are no refs that we can push. So situations occur where the push continues even though one of the refs can't be updated due to this inconsistency. That would be fine except that before we raise the PushExistsException, we call send_done() and hang up the connection. So the push goes on to fail with "Expected reply, got none" as the remote has already hung up. This commit moves the send_done() call further down so that it only happens once we know the PushExistsException is not going to be ignored. --- buildstream/_artifactcache/pushreceive.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py index 41dacf3..5cd65b2 100644 --- a/buildstream/_artifactcache/pushreceive.py +++ b/buildstream/_artifactcache/pushreceive.py @@ -222,6 +222,7 @@ class PushMessageWriter(object): self.write(command) def send_done(self): + logging.info('Sending done') command = PushCommand(PushCommandType.done, {}) self.write(command) @@ -497,7 +498,6 @@ class OSTreePusher(object): if parent is None: break if remote is not None and parent != remote: - self.writer.send_done() raise PushExistsException('Remote commit {} not descendent of ' 'commit {}'.format(remote, local)) @@ -552,7 +552,6 @@ class OSTreePusher(object): update_refs[branch] = remote_rev, rev if not update_refs: logging.info('Nothing to update') - self.writer.send_done() raise PushExistsException('Nothing to update') # Send update command @@ -583,6 +582,7 @@ class OSTreePusher(object): # Re-raise PushExistsException if all refs exist already if ref_count == 0 and exc_info: + self.writer.send_done() raise exc_info[0].with_traceback(exc_info[1], exc_info[2]) logging.info('Enumerating objects to send')
