maintainer-feedback requested: [Bug 245462] ports-mgmt/pkg: 1.14.2 pipe remains open while running scripts

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Apr 8 22:02:40 UTC 2020


Bugzilla Automation <bugzilla at FreeBSD.org> has asked freebsd-pkg mailing list
<pkg at FreeBSD.org> for maintainer-feedback:
Bug 245462: ports-mgmt/pkg: 1.14.2 pipe remains open while running scripts
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245462



--- Description ---
We are observing latest version of pkg hanging if some process spawn by the
script remains running after script itself exits.

Inspecting the process with GDB the pkg-static process stucks doing poll() on
FD#7:

(gdb) bt
#0  0x000000000084ba1a in _poll ()
#1  0x00000000007fad26 in __thr_poll ()
#2  0x00000000005e7303 in pkg_script_run (pkg=0x801079000,
type=PKG_SCRIPT_POST_INSTALL, upgrade=false) at scripts.c:248
#3  0x0000000000469574 in pkg_add_port (db=0x801078700, pkg=0x801079000,
input_path=0x7fffffffe7b7 "/tmp/media/ssp_port/work/stage", reloc=0x0,
testing=false)
    at pkg_ports.c:1338
#4  0x0000000000416535 in exec_register (argc=7, argv=0x7fffffffe3e8) at
register.c:195
#5  0x0000000000411202 in main (argc=7, argv=0x7fffffffe3e8) at main.c:886

Then checking the file descriptor table using lsof shows the following, the
stray denyhosts process is a culprit, however it's unclear why it should have a
pipe connected all the way to the pkg-static:

[sobomax at builder ~]$ ps -xalww | grep -w 33903
   0 33903 33901   0  52  0    27020   22276 select   I     -	  0:02.54
/usr/local/sbin/pkg-static register -i /tmp/media/ssp_port/work/stage -m
/tmp/media/ssp_port/work/.metadir -f /tmp/media/ssp_port/work/.PLIST.mktmp
   0 33923 33903   0  73  0	   0	   0 -	      Z     -	  0:02.16
<defunct>
   0 34324 33903   0  75  0	   0	   0 -	      Z     -	  0:00.00
<defunct>
   0 34325 33903   0  20  0    21096   17760 select   S     -	  0:00.01
/usr/local/bin/python2.7 /usr/local/bin/denyhosts.py --config
/usr/local/etc/denyhosts.conf --noemail --daemon
  70 34361 33903   0  73  0	   0	   0 -	      Z     -	  0:05.03
<defunct>
[sobomax at builder ~]$ sudo lsof | grep -w 0xfffff8017cc32000
pkg-stati 33903    root    7u	 unix 0xfffff8017cc32000		0t0    
    ->0xfffff80480a06000
python2.7 34325    root    4u	 unix 0xfffff80480a06000		0t0    
    ->0xfffff8017cc32000

I believe this is direct result of the single change here:

https://github.com/freebsd/pkg/commit/767fbd77ee64e22a31a4d5903c1e36dcd8533a70

Some comments were left in that commit as to how to fix possibly.


More information about the freebsd-pkg mailing list