You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:27:41 UTC

[buildstream] branch sam/pushing-fix created (now c50d64d)

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a change to branch sam/pushing-fix
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at c50d64d  _artifactcache/pushreceive.py: Avoid premature 'done' messages

This branch includes the following new commits:

     new c50d64d  _artifactcache/pushreceive.py: Avoid premature 'done' messages

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/01: _artifactcache/pushreceive.py: Avoid premature 'done' messages

Posted by tv...@apache.org.
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 <sa...@afuera.me.uk>
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')