From nobody Thu Apr 21 22:11:56 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D4F011991549 for ; Thu, 21 Apr 2022 22:11:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KksG44Hfcz4SBx for ; Thu, 21 Apr 2022 22:11:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7544011234 for ; Thu, 21 Apr 2022 22:11:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 23LMBuAw014111 for ; Thu, 21 Apr 2022 22:11:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 23LMBuj6014110 for bugs@FreeBSD.org; Thu, 21 Apr 2022 22:11:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 263458] /usr/bin/pkg sleeps 4 seconds on fetch failures Date: Thu, 21 Apr 2022 22:11:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: cgull@glup.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650579116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=h5hMxyTEMJtfh31PC5PBqrNBNR0aovr7vqyRkEdH/8o=; b=jB6MI4Z/iGVQZH3PbbxCbmGmt1Mk8+VV4XijH5u3wMQIOlBuTC5eFA8Gia60eu5XDlfvAl 32kYFeHhjhi/6m62a+grWs1cWhm1QHKVF3q/XoyoOnVU+nBxLm6RxxbdkiKgEDc+Jpq6iK Y8/FkasoGRbBC7FGNHbbb06RDoFKzNC4usrIZQ3c9aQ7m/vy202E8bkR4lfza94Oz0PHuf ZDDRN+jhQnVrM730yPQpgZVm/IvsYDa5MwT+lzaFLlwP3uGhtYhtMrFoOxQ1ZnWyY852Ls tKSKJEOreXX59Hw5Qh61+HBgMIB/dxN6vRASw+j8JEHbVlHzFZcuM0sEoSeROQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650579116; a=rsa-sha256; cv=none; b=lsDGhbMLLVdIlFL3tNk18qux8aN2puLZOEuLO8+RzkBlfPTWTeCMRoKfc3U2sVxL/QKOFN bSGsG4cM9Ed2Pj1FJC69D2n8/LY4JTauqvn7OSiLFIkXJH7IyaaXSNGfQnqf/BfNdx5XRo 21SmxlzsC/eixnI0NrN2DMoUEPUYTYYKnk+Ezdy813peCqZscCR35At6fPKOb6ex02mwLA 25CDn3vmzEi9QGp2ZUxRKYJDlIOtmkdLAeO3+9QbhhVyISj2+GuX2XNcCHbaRkPTXIGhtH DWV/61/T60nQTm5pu3X+5Vjg3CtJaaSsqH42iD9poE9zWZF6ozZy+4sPA1u1uQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263458 Bug ID: 263458 Summary: /usr/bin/pkg sleeps 4 seconds on fetch failures Product: Base System Version: 13.0-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: cgull@glup.org Created attachment 233383 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D233383&action= =3Dedit suggested change to eliminate a sleep(1) We recently discovered a bug in our `bsdinstall` package-install script; `p= kg query` wasn't being executed with a chroot into the target. This caused `/usr/sbin/pkg` to be invoked, it of course tries to bootstrap. On our install-CD boot, network has been configured but DNS is broken, so an error= is returned quickly by the resolver. In this situation `/usr/sbin/pkg` sleeps= 1 second before retries, and it retries 4 times. This multiplied to a 5+ min= ute delay in install that went unnoticed for years-- our fault, of course. This is not an earth-shattering bug and it no longer affects us, but if any= one else thinks it should be fixed, I've attached a suggested patch that removes the sleep. Network error/retry handling is always debatable of course, but= it seems reasonable to take that sleep out. This program is not that likely t= o be misused in ways that hammer servers. Suggested patch attached, also availa= ble at `https://github.com/cgull/freebsd-src`, branch `pkg-delay`. This sleep is in code that was copied from `pkg` itself, and `libpkg/fetch_libfetch.c` contains a corresponding `sleep(1)` also. But the code in `pkg` has grown more complex and it seems the path to this particul= ar case is narrower, I wasn't able to reproduce this in `pkg`. --=20 You are receiving this mail because: You are the assignee for the bug.=