[Yum-devel] pipe deadlock

Mike McLean mikem.rtp at gmail.com
Fri Oct 17 14:30:09 UTC 2008


The RPMTransaction creates a pipe and hands the write end to
rpm.setLogFile in order to catch scriptlet output. This will cause
pipe deadlock when rpmlib generates a large enough amount of log
output outside of the scriptlets. Output such as "warning: group
myfakegroup does not exist, using root" happens in rpmlib in the main
process, which means no one will read from the pipe until there is an
appropriate callback event. If this output exceeds the pipe buffer
size, you hit deadlock.

I'm not sure what the best solution is here. I suppose, ideally,
rpmlib would provide somewhat better controls. Short of that, I think
the thing to do might to fire off a thread that reads from the pipe
and provides unlimited buffering.

The following spec builds an rpm that will fail to install on my systems.

Name:       deadlock
Version:    1.0
Release:    1
Summary:    yum pipe deadlock example
License:    GPL
Group:      System Environment/Base
BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:  noarch
%description
Demonstrates pipe deadlock in yum
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/share/deadlock
set +x
for n in $(seq -w 3000)
do
    echo test >$RPM_BUILD_ROOT/usr/share/deadlock/test-$n
done
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,myfakegroup)
/usr/share/deadlock


More information about the Yum-devel mailing list