I am writing a program that queries packages on a remote ftp server. I found that rpm command was sitting forever and never returning and eating the entire cpu about 10% of the time. To get more debugging info I recompiled rpm with Debug=1 in lib/ftp.c The command and the corresponding output is: [rpmproj@sentinet rpm-3.0.3]$ ./rpm --rcfile ./rpmrc -vv -q -p ftp://sunsite.org.uk/Mirrors/ftp.calderasys tems.com/pub/OpenLinux/1.3/col/contrib/RPMS/howto-pl-sgml-19 980729-1.i386.rpm D: logging into sunsite.org.uk as ftp, pw (username) ++ connect 193.63.255.4:21 on fd 3 and there it sits, forever eating all the cpu. At this time netstat shows: tcp 0 0 sentinet.co.uk:3763 swallow.doc.ic.ac.u:ftp CLOSE_WAIT The output of tcpdump during this time is: 21:27:48.930079 sentinet.co.uk.3766 > swallow.doc.ic.ac.uk.ftp: S 3007349526:3007349526(0) win 32120 <mss 1460,sackOK,timestamp 427876587 0,nop,wscale 0> (DF) (ttl 64, id 34262) 4500 003c 85d6 4000 4006 b19d c152 81b1 c13f ff04 0eb6 0015 b340 8316 0000 0000 a002 7d78 87b8 0000 0204 05b4 0402 080a 1980 e0eb 0000 0000 0103 0300 21:27:49.033345 swallow.doc.ic.ac.uk.ftp > sentinet.co.uk.3766: S 130578483:130578483(0) ack 3007349527 wi n 10136 <nop,nop,timestamp 804265412 427876587,nop,wscale 0,nop,nop,sackOK,mss 1460> (DF) (ttl 247, id 106 65) 4500 0040 29a9 4000 f706 56c6 c13f ff04 c152 81b1 0015 0eb6 07c8 7833 b340 8317 b012 2798 fdd1 0000 0101 080a 2ff0 1dc4 1980 e0eb 0103 0300 0101 0402 0204 05b4 21:27:49.033380 sentinet.co.uk.3766 > swallow.doc.ic.ac.uk.ftp: . ack 1 win 32120 <nop,nop,timestamp 42787 6597 804265412> (DF) (ttl 64, id 34265) 4500 0034 85d9 4000 4006 b1a2 c152 81b1 c13f ff04 0eb6 0015 b340 8317 07c8 7834 8010 7d78 e8b2 0000 0101 080a 1980 e0f5 2ff0 1dc4 21:27:49.107570 swallow.doc.ic.ac.uk.ftp > sentinet.co.uk.3766: F 1:1(0) ack 1 win 10136 <nop,nop,timestam p 804265420 427876597> (DF) (ttl 247, id 10666) 4500 0034 29aa 4000 f706 56d1 c13f ff04 c152 81b1 0015 0eb6 07c8 7834 b340 8317 8011 2798 3e8a 0000 0101 080a 2ff0 1dcc 1980 e0f5 21:27:49.107592 sentinet.co.uk.3766 > swallow.doc.ic.ac.uk.ftp: . ack 2 win 32120 <nop,nop,timestamp 42787 6604 804265420> (DF) (ttl 64, id 34267) 4500 0034 85db 4000 4006 b1a0 c152 81b1 c13f ff04 0eb6 0015 b340 8317 07c8 7835 8010 7d78 e8a2 0000 0101 080a 1980 e0fc 2ff0 1dcc if I kill the rpm command the netstat CLOSE_WAIT disapears immediately and we get the following packet exchange 21:28:09.879625 sentinet.co.uk.3766 > swallow.doc.ic.ac.uk.ftp: F 3007349527:3007349527(0) ack 130578485 w in 32120 <nop,nop,timestamp 427878682 804265420> (DF) (ttl 64, id 34309) 4500 0034 8605 4000 4006 b176 c152 81b1 c13f ff04 0eb6 0015 b340 8317 07c8 7835 8011 7d78 e083 0000 0101 080a 1980 e91a 2ff0 1dcc 21:28:09.911831 swallow.doc.ic.ac.uk.ftp > sentinet.co.uk.3766: . ack 1 win 10136 <nop,nop,timestamp 80426 7500 427878682> (DF) (ttl 247, id 31555) 4500 0034 7b43 4000 f706 0538 c13f ff04 c152 81b1 0015 0eb6 07c8 7835 b340 8318 8010 2798 2e44 0000 0101 080a 2ff0 25ec 1980 e91a
This output was generated with rpm version 3.0.3. It is identical with the version 3.0 supplied with RedHat 6.0 and version rpm version 3.0.2
It is repeatable across multiple machines running RedHat 6.0
Your command works for me running ~rpm-3.0.3 on Red Hat 6.1/sparc. The tcpdump indicates that the ftp connection initiated on the local machine (sentinet?) is being immediately closed by the remote machine (swallow?). This is not an rpm problem, but rather an FTP configuration problem. Several other things: 1) --rcfile ./rpmrc rpm-3.0.x no longer reads /usr/lib/rpm/rpmrc by default. That means that either ./rpmrc must do include: /usr/lib/rpm/rpmrc or you should invoke as --rcfile /usr/lib/rpm/rpmrc:./rpmrc (Add /etc/rpmrc and/or ~/.rpmrc if those are required) 2) rpm uses passive FTP for all transfers.