rpm randomly hangs when trying to install packages. It either hangs completely, looping over code like (strace) read(4, "\0\236\0\0\210m\33\0\0\0\0\0\1\0"..., 16) = 16 lseek(4, 1797512, SEEK_SET) = 1797512 read(4, "\0\236\0\0\210m\33\0\0\0\0\0\1\0"..., 16) = 16 lseek(4, 1797512, SEEK_SET) = 1797512 read(4, "\0\236\0\0\210m\33\0\0\0\0\0\1\0"..., 16) = 16 lseek(4, 1797512, SEEK_SET) = 1797512 read(4, "\0\236\0\0\210m\33\0\0\0\0\0\1\0"..., 16) = 16 lseek(4, 1797512, SEEK_SET) = 1797512 read(4, "\0\236\0\0\210m\33\0\0\0\0\0\1\0"..., 16) = 16 lseek(4, 1797512, SEEK_SET) = 1797512 /proc/4462/fd/4 -> /var/lib/rpm/packages.rpm Or it terminates and reports "freelist corrupt", and after a --rebuilddb installs fine. This happens on a larger set of machines and not entirely repeatable. Do you need a copy of the rpm database or anything?
The infinite loop is the "freelist corrupt" bug with a different manifestation. Try "rpm --rebuilddb" and you should be OK. If you (or anyone else) can reproduce this problem with a known sequence of commands starting from rebuilt and saved /var/lib/rpm/* databases, please send me the data so I can get this problem fixed. This problem is very hard to reproduce without a known good starting database.
Created attachment 92708 [details] a makefile to reproduce This makefile starts off with an initdb, and recreates the problem pretty reliably. The RPMs are from redhat 7.3 and 8.0, and are all available on rpmfind.net.