Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zypper crashes when cancelling #384

Open
cy6erGn0m opened this issue Mar 15, 2022 · 6 comments
Open

zypper crashes when cancelling #384

cy6erGn0m opened this issue Mar 15, 2022 · 6 comments
Labels

Comments

@cy6erGn0m
Copy link
Contributor

cy6erGn0m commented Mar 15, 2022

opensuse Leap 15.4 
zypper 1.14.52

Steps:

  1. Run leap in docker
docker run --init --ulimit core=-1 --mount type=bind,source=/tmp/,target=/tmp/ -it opensuse/leap:15.4
  1. Start zypper in, wait for zypper start updating repos, then cancel via Ctrl-C twice
# zypper in file
Retrieving repository 'Update repository of openSUSE Backports' metadata ...................................................................................................................................[error]
Repository 'Update repository of openSUSE Backports' is invalid.
[repo-backports-update|http://download.opensuse.org/update/leap/15.4/backports/] Valid metadata not found at specified URL                                                                                         
History:                                                                                                                                                                                                           
 - [|] Error trying to read from 'http://download.opensuse.org/update/leap/15.4/backports/'                                                                                                                        
 - Download (curl) error for 'http://download.opensuse.org/update/leap/15.4/backports/content':                                                                                                                    
   Error code: Connection failed                                                                                                                                                                                   
   Error message: Could not resolve host: download.opensuse.org                                                                                                                                                    

Please check if the URIs defined for this repository are pointing to a valid repository.
Warning: Skipping repository 'Update repository of openSUSE Backports' because of the above error.
Retrieving repository 'Non-OSS Repository' metadata ........................................................................................................................................................[error]
Repository 'Non-OSS Repository' is invalid.
[repo-non-oss|http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/] Valid metadata not found at specified URL                                                                                         
History:                                                                                                                                                                                                           
 - [|] Error trying to read from 'http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/'                                                                                                               
 - Download (curl) error for 'http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/content':                                                                                                           
   Error code: Connection failed                                                                                                                                                                                   
   Error message: Could not resolve host: download.opensuse.org                                                                                                                                                    

Please check if the URIs defined for this repository are pointing to a valid repository.
Warning: Skipping repository 'Non-OSS Repository' because of the above error.
Retrieving repository 'Main Repository' metadata ---------------------------------------------------------------------------------------------------------------------------------------------------------------[/]
^C^CSegmentation fault (core dumped)

coredump

core.Zypp-main.29.zip

@mlandres
Copy link
Member

@cy6erGn0m The corresponding /var/log/zypper.log - if available - would be helpful. (try zypper log to see the content, zypper log PID to extract the log of a specific command).

@cy6erGn0m
Copy link
Contributor Author

zypper.log.zip

@cy6erGn0m
Copy link
Contributor Author

cy6erGn0m commented Mar 15, 2022

Please note that the network error is expected: this is because a proxy is required to make the repo available. So it's not the issue itself

@cy6erGn0m
Copy link
Contributor Author

cy6erGn0m commented Mar 15, 2022

A little bit more info with debug symbols and gdb

^C
Thread 1 "Zypp-main" received signal SIGINT, Interrupt.
^C
Thread 1 "Zypp-main" received signal SIGINT, Interrupt.
[Thread 0x7fb3282b7700 (LWP 1476) exited]

Thread 1 "Zypp-main" received signal SIGSEGV, Segmentation fault.
__GI___pthread_rwlock_wrlock (rwlock=0x0) at pthread_rwlock_wrlock.c:27
27      pthread_rwlock_wrlock.c: No such file or directory.
Missing separate debuginfos, use: zypper install krb5-debuginfo-1.19.2-150400.1.5.x86_64
(gdb) bt
#0  __GI___pthread_rwlock_wrlock (rwlock=0x0) at pthread_rwlock_wrlock.c:27
#1  0x00007fb32dcb84d9 in CRYPTO_THREAD_write_lock (lock=<optimized out>) at crypto/threads_pthread.c:78
#2  0x00007fb32dc764a3 in RAND_get_rand_method () at crypto/rand/rand_lib.c:854
#3  0x00007fb32dc76929 in RAND_status () at crypto/rand/rand_lib.c:963
#4  0x00007fb32f8be4ae in rand_enough () at vtls/openssl.c:433
#5  ossl_seed (data=0x56442eeb6190) at vtls/openssl.c:444
#6  0x00007fb32f8be606 in ossl_random (data=<optimized out>, entropy=0x7fff21eb2c34 "", length=4) at vtls/openssl.c:4440
#7  0x00007fb32f89cf8b in randit (rnd=0x7fff21eb2c34, data=0x56442eeb6190) at rand.c:66
#8  Curl_rand (data=data@entry=0x56442eeb6190, rnd=rnd@entry=0x7fff21eb2c80 "\001\b", num=num@entry=4) at rand.c:129
#9  0x00007fb32f89d109 in Curl_rand_hex (data=data@entry=0x56442eeb6190, rnd=rnd@entry=0x7fff21eb2d6f "", num=8, num@entry=9) at rand.c:171
#10 0x00007fb32f86a854 in cookie_output (filename=0x56442edecee0 "/var/lib/YaST2/cookies", c=0x56442edef0e0, data=0x56442eeb6190) at cookie.c:1607
#11 Curl_flush_cookies (data=data@entry=0x56442eeb6190, cleanup=cleanup@entry=true) at cookie.c:1744
#12 0x00007fb32f8b3c8b in Curl_close (datap=datap@entry=0x7fff21eb2de8) at url.c:426
#13 0x00007fb32f870b99 in curl_easy_cleanup (data=<optimized out>) at easy.c:742
#14 0x00007fb331332f81 in zypp::media::MediaCurl::disconnectFrom (this=0x56442ed94310) at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaCurl.cc:621
#15 0x00007fb33130ed05 in zypp::media::MediaHandler::disconnect (this=0x56442ed94310) at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaHandler.cc:728
#16 0x00007fb33131622d in zypp::media::MediaHandler::release (this=this@entry=0x56442ed94310, ejectDev=...) at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaHandler.cc:759
#17 0x00007fb331351d05 in zypp::media::(anonymous namespace)::ManagedMedia::close (this=this@entry=0x56442ee49828) at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaManager.cc:106
#18 0x00007fb331357fcb in zypp::media::(anonymous namespace)::ManagedMedia::~ManagedMedia (this=0x56442ee49828, __in_chrg=<optimized out>)
    at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaManager.cc:51
#19 std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>::~pair (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/c++/7/bits/stl_pair.h:208
#20 __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::destroy<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > (this=<optimized out>, __p=<optimized out>) at /usr/include/c++/7/ext/new_allocator.h:140
#21 std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > > >::destroy<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > (__a=..., __p=<optimized out>) at /usr/include/c++/7/bits/alloc_traits.h:487
#22 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_destroy_node (this=0x56442eea1668, __p=0x56442ee49800)
    at /usr/include/c++/7/bits/stl_tree.h:650
#23 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_drop_node (this=0x56442eea1668, __p=0x56442ee49800)
    at /usr/include/c++/7/bits/stl_tree.h:658
#24 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::_M_erase (__x=0x56442ee49800, this=0x56442eea1668)
    at /usr/include/c++/7/bits/stl_tree.h:1858
#25 std::_Rb_tree<unsigned int, std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia>, std::_Select1st<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> >, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::clear (this=0x56442eea1668) at /usr/include/c++/7/bits/stl_tree.h:1171
#26 std::map<unsigned int, zypp::media::(anonymous namespace)::ManagedMedia, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, zypp::media::(anonymous namespace)::ManagedMedia> > >::clear (
    this=0x56442eea1668) at /usr/include/c++/7/bits/stl_map.h:1127
#27 zypp::media::MediaManager_Impl::~MediaManager_Impl (this=<optimized out>, __in_chrg=<optimized out>) at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp/media/MediaManager.cc:241
#28 boost::checked_delete<zypp::media::MediaManager_Impl> (x=0x56442eea1660) at /usr/include/boost/core/checked_delete.hpp:34
#29 boost::detail::sp_counted_impl_p<zypp::media::MediaManager_Impl>::dispose (this=<optimized out>) at /usr/include/boost/smart_ptr/detail/sp_counted_impl.hpp:92
#30 0x00007fb331357661 in boost::detail::sp_counted_base::release (this=0x56442eea32b0) at /usr/include/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp:110
#31 boost::detail::shared_count::~shared_count (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:426
#32 boost::shared_ptr<zypp::media::MediaManager_Impl>::~shared_ptr (this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:341
#33 zypp::RW_pointer<zypp::media::MediaManager_Impl, zypp::rw_pointer::Shared<zypp::media::MediaManager_Impl> >::~RW_pointer (this=<optimized out>, __in_chrg=<optimized out>)
    at /usr/src/debug/libzypp-17.29.5-150400.1.1.x86_64/zypp-core/base/PtrTypes.h:285
#34 0x00007fb32ffbd14e in __cxa_finalize (d=0x7fb331aa3680) at cxa_finalize.c:83
#35 0x00007fb3312b5a93 in __do_global_dtors_aux () from /usr/lib64/libzypp.so.1722
#36 0x00007fff21eb3490 in ?? ()
#37 0x00007fb331ac05a3 in _dl_fini () at dl-fini.c:138
Backtrace stopped: frame did not save the PC

@mlandres
Copy link
Member

Thanks, this was valuable. It's a race between zypp releasing the curl handles and the openssl atexit handler.
We must make sure the curl handles are closed before zypper leaves main. When cleaning up curl in our global DTORs, curl might refer to openssl, which is unavailable after the atexit handler is done.

@mlandres mlandres added the bug label Mar 15, 2022
@cy6erGn0m
Copy link
Contributor Author

cy6erGn0m commented Mar 15, 2022

updated also with libcurl-debuginfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants