openSUSE / zypper

World's most powerful command line package manager
http://en.opensuse.org/Portal:Zypper
Other
392 stars 107 forks source link

When network is unresponsive, Ctrl-C has no real effect #522

Closed jengelh closed 6 months ago

jengelh commented 7 months ago

Versions: 1.14.68 & 1.14.68-8-gec903f7a

# cat /etc/zypp/repos.d/base.repo
[base]
enabled=1
autorefresh=1
baseurl=http://ftp.gwdg.de/pub/linux/suse/opensuse/tumbleweed/repo/oss

# iptables -I OUTPUT -d ftp.gwdg.de -j DROP
# ip6tables -I OUTPUT -d ftp.gwdg.de -j DROP
# rm -Rf /var/cache/zypp*

# zypper in --download-only '0ad-data'
Retrieving repository 'base' metadata ------------------------------------------------------------------------------------------------[\]^C
Trying to exit gracefully...
^C
Zypper is currently cleaning up, exiting as soon as possible.
^C
Zypper is currently cleaning up, exiting as soon as possible.
^C
Zypper is currently cleaning up, exiting as soon as possible.
^C
gdb -p xxx
bt
#0  0x00007f29aeb09d7f in __GI___poll (fds=0x7ffd2f6ae1b0, nfds=3, timeout=1000) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f29ae9a1c70 in poll (__timeout=<optimized out>, __nfds=<optimized out>, __fds=0x7ffd2f6ae1b0) at /usr/include/bits/poll2.h:39
#2  Curl_poll (ufds=0x7ffd2f6ae1b0, nfds=<optimized out>, timeout_ms=<optimized out>) at /usr/src/debug/curl-8.5.0/lib/select.c:317
#3  0x00007f29ae997e5a in multi_wait
    (multi=<optimized out>, extra_fds=0x0, extra_nfds=<optimized out>, timeout_ms=<optimized out>, ret=<optimized out>, extrawait=extrawait@entry=true, use_wakeup=<optimized out>) at /usr/src/debug/curl-8.5.0/lib/multi.c:1300
#4  0x00007f29ae99800a in multi_wait
    (use_wakeup=true, extrawait=true, ret=<optimized out>, timeout_ms=<optimized out>, extra_nfds=<optimized out>, extra_fds=<optimized out>, multi=<optimized out>) at /usr/src/debug/curl-8.5.0/lib/multi.c:1439
#5  curl_multi_poll
    (multi=<optimized out>, extra_fds=<optimized out>, extra_nfds=<optimized out>, timeout_ms=<optimized out>, ret=<optimized out>)
    at /usr/src/debug/curl-8.5.0/lib/multi.c:1440
#6  0x00007f29ae9705fb in easy_transfer (multi=<optimized out>) at /usr/src/debug/curl-8.5.0/lib/easy.c:668
#7  easy_perform (events=false, data=0x55a2705f9250) at /usr/src/debug/curl-8.5.0/lib/easy.c:761
#8  curl_easy_perform (data=0x55a2705f9250) at /usr/src/debug/curl-8.5.0/lib/easy.c:780
#9  0x00007f29af3d20af in zypp::media::MediaCurl::doGetDoesFileExist(zypp::filesystem::Pathname const&) const
    (this=0x55a2705b9f10, filename=...) at /usr/src/debug/libzypp-17.31.25/zypp/media/MediaCurl.cc:1065
#10 0x00007f29af3d0a0a in zypp::media::MediaCurl::getDoesFileExist(zypp::filesystem::Pathname const&) const
    (this=0x55a2705b9f10, filename=...) at /usr/src/debug/libzypp-17.31.25/zypp/media/MediaCurl.cc:810
#11 0x00007f29af4a9777 in zypp::ProvideFileExistenceOperation::operator()(unsigned int, zypp::OnMediaLocation const&)
    (file=<optimized out>, media=1, this=0x7ffd2f6ae8ef) at /usr/src/debug/libzypp-17.31.25/zypp/MediaSetAccess.cc:161
#12 std::__invoke_impl<void, zypp::ProvideFileExistenceOperation&, unsigned int, zypp::OnMediaLocation const&>(std::__invoke_other, zypp::ProvideFileExistenceOperation&, unsigned int&&, zypp::OnMediaLocation const&) (__f=...) at /usr/include/c++/13/bits/invoke.h:61
#13 std::__invoke<zypp::ProvideFileExistenceOperation&, unsigned int, zypp::OnMediaLocation const&>(zypp::ProvideFileExistenceOperation&, unsigned int&&, zypp::OnMediaLocation const&) (__fn=...) at /usr/include/c++/13/bits/invoke.h:96
#14 std::reference_wrapper<zypp::ProvideFileExistenceOperation>::operator()<unsigned int, zypp::OnMediaLocation const&>(unsigned int&&, zypp::OnMediaLocation const&) const (this=<optimized out>) at /usr/include/c++/13/bits/refwrap.h:359
#15 boost::detail::function::void_function_obj_invoker2<std::reference_wrapper<zypp::ProvideFileExistenceOperation>, void, unsigned int, zypp::OnMediaLocation const&>::invoke(boost::detail::function::function_buffer&, unsigned int, zypp::OnMediaLocation const&)
    (function_obj_ptr=<optimized out>, a0=1, a1=<optimized out>) at /usr/include/boost/function/function_template.hpp:158
#16 0x00007f29af4aa9d9 in boost::function2<void, unsigned int, zypp::OnMediaLocation const&>::operator()(unsigned int, zypp::OnMediaLocation const&) const (a1=<optimized out>, a0=1, this=0x7ffd2f6ae900) at /usr/include/boost/function/function_template.hpp:771
#17 zypp::MediaSetAccess::provide(boost::function<void (unsigned int, zypp::OnMediaLocation const&)>, zypp::OnMediaLocation const&, zypp::base::Flags<zypp::MediaSetAccess::ProvideFileOption>) (this=this@entry=0x7ffd2f6aeb70, op=..., resource=..., options=..., 
    options@entry=...) at /usr/src/debug/libzypp-17.31.25/zypp/MediaSetAccess.cc:283
#18 0x00007f29af4ab3e0 in zypp::MediaSetAccess::doesFileExist(zypp::filesystem::Pathname const&, unsigned int)
    (this=0x7ffd2f6aeb70, file=<optimized out>, media_nr=1) at /usr/src/debug/libzypp-17.31.25/zypp/MediaSetAccess.cc:234
#19 0x00007f29af60cf45 in zypp::RepoManager::Impl::probe(zypp::Url const&, zypp::filesystem::Pathname const&) const [clone .isra.0]
    (url=..., path=..., this=<optimized out>) at /usr/src/debug/libzypp-17.31.25/zypp/RepoManager.cc:1501
#20 0x00007f29af60d8d3 in zypp::RepoManager::Impl::refreshMetadata(zypp::RepoInfo const&, zypp::RepoManager::RawMetadataRefreshPolicy, boost::function<bool (zypp::ProgressData const&)> const&) [clone .isra.0]
    (this=0x55a270606d40, info=..., policy=zypp::RepoManager::RefreshForced, progress=<optimized out>)
    at /usr/src/debug/libzypp-17.31.25/zypp/RepoManager.cc:1177
#21 0x000055a26f59e427 in refresh_raw_metadata(Zypper&, zypp::RepoInfo const&, bool) (zypper=..., repo=..., force_download=false)
    at ~/zypper/src/repos.cc:296
#22 0x000055a26f5b60b0 in do_init_repos<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(Zypper&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) (zypper=..., container=std::vector of length 0, capacity 0)
    at ~/zypper/src/repos.cc:860
#23 0x000055a26f5b2164 in init_repos<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(Zypper&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) (zypper=..., container=std::vector of length 0, capacity 0) at ~/zypper/src/repos.cc:960
#24 0x000055a26f5a3607 in init_repos(Zypper&) (zypper=...) at ~/zypper/src/repos.cc:973
#25 0x000055a26f5dcf83 in ZypperBaseCommand::defaultSystemSetup(Zypper&, zypp::base::Flags<SetupSystemBits>)
    (this=0x55a270524da0, zypper=..., flags_r=...) at ~/zypper/src/commands/basecommand.cc:175
#26 0x000055a26f655b15 in InstallCmd::execute(Zypper&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)
    (this=0x55a270524da0, zypper=..., positionalArgs_r=std::vector of length 1, capacity 1 = {...})
    at ~/zypper/src/commands/installremove.cc:263
#27 0x000055a26f5dd508 in ZypperBaseCommand::run(Zypper&) (this=0x55a270524da0, zypper=...)
    at ~/zypper/src/commands/basecommand.cc:262
#28 0x000055a26f53c3d2 in Zypper::doCommand(int, char**, int)
    (this=0x55a26f8aab20 <Zypper::instance(bool)::_instance>, cmdArgc=4, cmdArgv=0x7ffd2f6b0ac8, firstFlag=1)
    at ~/zypper/src/Zypper.cc:676
#29 0x000055a26f538a4a in Zypper::main(int, char**)
    (this=0x55a26f8aab20 <Zypper::instance(bool)::_instance>, argc=4, argv=0x7ffd2f6b0ac8)
    at ~/zypper/src/Zypper.cc:213
#30 0x000055a26f4fd7c7 in main(int, char**) (argc=4, argv=0x7ffd2f6b0ac8) at ~/zypper/src/main.cc:163

Looks like curl is ignoring -EINTR from poll.

Other notes:

If metadata is already is present in the system and recent, package download of course won't start but zypper is successfully cancellable.

# ./src/zypper in --download-only '0ad-data'
Loading repository data...
Reading installed packages...
[TechPreview] $ZYPP_SINGLE_RPMTRANS=1 : New rpm install backend is enabled
              If you find any bugs or issues please let us know:
              https://bugzilla.opensuse.org/
              Component: libzypp (or zypper)
              And please attach the /var/log/zypper.log to the bug report.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  0ad-data dejavu-fonts gnu-free-fonts

3 new packages to install.
Overall download size: 1.40 GiB. Already cached: 0 B. Download only.
Continue? [y/n/v/...? shows all options] (y): 
Retrieving: dejavu-fonts-2.37-1.19.noarch (base)                                                                     (1/3),   2.7 MiB    
Retrieving: dejavu-fonts-2.37-1.19.noarch.rpm ----------------------------------------------------------------------------------------[|]^C
Trying to exit gracefully...
Retrieving: dejavu-fonts-2.37-1.19.noarch.rpm ....................................................................................[error]
Download (curl) error for 'http://ftp.gwdg.de/pub/linux/suse/opensuse/tumbleweed/repo/oss/noarch/dejavu-fonts-2.37-1.19.noarch.rpm':
Error code: User abort
Error message: Callback aborted