From patchwork Fri Apr 7 18:13:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 67530 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D9A9E3858C74 for ; Fri, 7 Apr 2023 18:13:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9A9E3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680891223; bh=HVu1CDQ0ul1mZLHwCWlKGVP3H8I5cqgbp7/22cxkl1s=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=hChaZ5K66B1siLvHtGDXAObuni0ATjoKutEEgrpGnF0y4QUUZAXMQv1TWdqiurU4p by4QSozpmipPmsYQ+HRpgRR8afODyxYYlidlyK3CQUI1SOijCc51+yRL+iLQ7yUWY8 vLN5wi6MbT654hC0Fh5WtyQ+sor4bbwNpzHH/i30= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DA3423858D32 for ; Fri, 7 Apr 2023 18:13:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA3423858D32 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-c1ejMMf4MJWh5k8CS6A4sg-1; Fri, 07 Apr 2023 14:13:37 -0400 X-MC-Unique: c1ejMMf4MJWh5k8CS6A4sg-1 Received: by mail-qv1-f69.google.com with SMTP id c15-20020a056214070f00b005bb308e7c12so19672721qvz.19 for ; Fri, 07 Apr 2023 11:13:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680891217; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HVu1CDQ0ul1mZLHwCWlKGVP3H8I5cqgbp7/22cxkl1s=; b=TvkCnRlLLv1wIbI99dwVPmt/mtzCPr4KvHd4NMJC0TDSV2DzkLa1ZIN/B9LNgcnJGG Ev+drbNQMlRx2pzEIqHIO+AjExuYxR9XAM3W8WB2TCmyCurF6oZdBCBvxype2YdKZ+3P +/Xh/4Y19dmyNvj0+E0Xxv5h5urTixg5FwbUSWTNMtnMF5h1FOzQAv8qlfxIOPC5MHxi gpTML/+xFdGUqC1lJlZa3V4uKaLJ0RqK1/UXiqgzAmRKlKAb1FA1N0lIVPlNT4U6tFh4 8c9Wc1qmTJfJ5izWouTlmUBj2ghm+o11PiFWmBR+pb8nG7/B2vhqfXda8njQgswjxF10 B5gQ== X-Gm-Message-State: AAQBX9flncnAicZaNlthsmoZdU9dBVxtI6AwGluZlqLOsa65D9OM+Bdh Sq3KOXV30hL2dGMQh6iX0wCGlDqod51pM9NXSIbO5q+pxqaUsuhnhJ513XEHfbQDA6c0QJNXwAA tgHLUcEoanjRZskpdEldOVa4mgwu9pirX4R5EyIEmQJ40U+0h2O+bC3aPk3Wrsv3qvKy5tTOuHC Bj X-Received: by 2002:ad4:5bae:0:b0:5c2:d241:9c1d with SMTP id 14-20020ad45bae000000b005c2d2419c1dmr4405880qvq.27.1680891216837; Fri, 07 Apr 2023 11:13:36 -0700 (PDT) X-Google-Smtp-Source: AKy350asN+tAP8KrYJW2h8O07+iJvMArKhksJlEcG0erB0wCE+4bigbZ7BzLhJL+opQX+P9MmaKRfQ== X-Received: by 2002:ad4:5bae:0:b0:5c2:d241:9c1d with SMTP id 14-20020ad45bae000000b005c2d2419c1dmr4405853qvq.27.1680891216486; Fri, 07 Apr 2023 11:13:36 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id s63-20020a37a942000000b00706b09b16fasm1471625qke.11.2023.04.07.11.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 11:13:36 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id E2B42581C7B; Fri, 7 Apr 2023 20:13:34 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied] fedabipkgdiff: Remove busy loop when forking abipkgdiff Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Fri, 07 Apr 2023 20:13:34 +0200 Message-ID: <87ttxrk1bl.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" Hello, The function abipkgdiff() introduced a busy loop instead of using subprocess.communicate() because it was randomly hanging back in the python2 days. This patch removes the busy loop altogether as I could not reproduce the hanging anymore. * tools/fedabipkgdiff (abipkgdiff): Remove the busy looping and use subprocess.communicate() instead. Signed-off-by: Dodji Seketeli --- tools/fedabipkgdiff | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff index 960b15a6..e9c211cf 100755 --- a/tools/fedabipkgdiff +++ b/tools/fedabipkgdiff @@ -1182,30 +1182,8 @@ def abipkgdiff(cmp_half1, cmp_half2): proc = subprocess.Popen(' '.join(cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) - # So we could have done: stdout, stderr = proc.communicate() - # But then the documentatin of proc.communicate says: - # - # Note: The data read is buffered in memory, so do not use this - # method if the data size is large or unlimited. " - # - # In practice, we are seeing random cases where this - # proc.communicate() function does *NOT* terminate and seems to be - # in a deadlock state. So we are avoiding it altogether. We are - # then busy looping, waiting for the spawn process to finish, and - # then we get its output. - # - - sleeptime = 0.2 - while True: - if proc.poll() != None: - break - time.sleep(sleeptime) - # cap the sleep time at 1.6s - if sleeptime < 2.0: - sleeptime = sleeptime * 2 - - stdout = ''.join(proc.stdout.readlines()) - stderr = ''.join(proc.stderr.readlines()) + + stdout, stderr = proc.communicate() is_ok = proc.returncode == ABIDIFF_OK is_internal_error = proc.returncode & ABIDIFF_ERROR or proc.returncode & ABIDIFF_USAGE_ERROR