Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Apr 2022 22:11:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 263458] /usr/bin/pkg sleeps 4 seconds on fetch failures
Message-ID:  <bug-263458-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-263458-227>