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

Ctrl-C when dumping sometimes causes nix build to deadlock #5438

Open
oxalica opened this issue Oct 27, 2021 · 1 comment
Open

Ctrl-C when dumping sometimes causes nix build to deadlock #5438

oxalica opened this issue Oct 27, 2021 · 1 comment

Comments

@oxalica
Copy link
Contributor

oxalica commented Oct 27, 2021

Describe the bug

In title.

Steps To Reproduce

  1. Checkout a random revision in nixpkgs git repo.
  2. nix build .#wine --dry-run (or any other path)
  3. Before it prints anything, wait about 1.5s (for my computer) and Ctrl-C.
  4. It stuck without any output, consuming no CPU and no disk throughput.
  5. Pressing more Ctrl-C or kill has no effects. it needs kill -9 or kill -SIGABRT to be terminated.

Note:

  • In the whole process, nothing is printed to stdout or stderr.
  • The time between starting and pressing Ctrl-C should be precise (but depends on disk and CPU speed) to trigger the bug. Ctrl-C too early triggers Failed to open archive, too late triggers interrupted by the user, and between them triggers a deadlock.

Expected behavior

It cancels, prints an error message, and exits.

nix-env --version output

nix-env (Nix) 2.5pre20211007_844dd90

Additional context

Backtrace:

[Current thread is 1 (Thread 0x7f55e7d90f40 (LWP 2730622))]
(gdb) bt
#0  0x00007f55e9307d05 in __futex_abstimed_wait_common64 ()
   from /nix/store/mij848h2x5wiqkwhg027byvmf9x3gx7y-glibc-2.33-50/lib/libpthread.so.0
#1  0x00007f55e92fd193 in __pthread_clockjoin_ex ()
   from /nix/store/mij848h2x5wiqkwhg027byvmf9x3gx7y-glibc-2.33-50/lib/libpthread.so.0
#2  0x00007f55e9544e63 in std::thread::join() ()
   from /nix/store/7fv9v6mnlkb4ddf9kz1snknbvbfbcbx0-gcc-10.3.0-lib/lib/libstdc++.so.6
#3  0x00007f55e9ab0eb5 in std::_Function_handler<void (), nix::ConnectionHandle::withFramedSink(std::function<void (nix::Sink&)>)::{lambda()#2}>::_M_invoke(std::_Any_data const&) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixstore.so
#4  0x0000560ba9a3dc7e in Finally::~Finally() ()
#5  0x00007f55e98ef5be in nix::ConnectionHandle::withFramedSink(std::function<void (nix::Sink&)>) [clone .cold] ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixstore.so
#6  0x00007f55e9ab5e33 in nix::RemoteStore::addCAToStore(nix::Source&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::variant<nix::TextHashMethod, nix::FixedOutputHashMethod>, std::set<nix::StorePath, std::less<nix::StorePath>, std::allocator<nix::StorePath> > const&, nix::RepairFlag) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixstore.so
#7  0x00007f55e9ab68b7 in virtual thunk to nix::RemoteStore::addToStoreFromDump(nix::Source&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, nix::FileIngestionMethod, nix::HashType, nix::RepairFlag) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixstore.so
#8  0x00007f55e9ae440f in nix::Store::addToStore(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, nix::FileIngestionMethod, nix::HashType, std::function<bool (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, nix::RepairFlag) () from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixstore.so
#9  0x00007f55e9c232fb in nix::fetchers::GitInputScheme::fetch(nix::ref<nix::Store>, nix::fetchers::Input const&) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixfetchers.so
--Type <RET> for more, q to quit, c to continue without paging--
#10 0x00007f55e9c12e03 in nix::fetchers::Input::fetch(nix::ref<nix::Store>) const ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixfetchers.so
#11 0x00007f55ea066dcc in nix::FlakeRef::fetchTree(nix::ref<nix::Store>) const ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixexpr.so
#12 0x00007f55ea058832 in nix::flake::fetchOrSubstituteTree(nix::EvalState&, nix::FlakeRef const&, bool, std::vector<std::pair<nix::FlakeRef, std::pair<nix::fetchers::Tree, nix::FlakeRef> >, std::allocator<std::pair<nix::FlakeRef, std::pair<nix::fetchers::Tree, nix::FlakeRef> > > >&) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixexpr.so
#13 0x00007f55ea0599f2 in nix::flake::getFlake(nix::EvalState&, nix::FlakeRef const&, bool, std::vector<std::pair<nix::FlakeRef, std::pair<nix::fetchers::Tree, nix::FlakeRef> >, std::allocator<std::pair<nix::FlakeRef, std::pair<nix::fetchers::Tree, nix::FlakeRef> > > >&) () from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixexpr.so
#14 0x00007f55ea05ad71 in nix::flake::lockFlake(nix::EvalState&, nix::FlakeRef const&, nix::flake::LockFlags const&) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixexpr.so
#15 0x00007f55e968e02a in nix::InstallableFlake::getLockedFlake() const ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#16 0x00007f55e9692ca4 in nix::InstallableFlake::toDerivation[abi:cxx11]() ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#17 0x00007f55e969334b in nix::InstallableFlake::toDerivations() ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#18 0x00007f55e9691bfd in nix::InstallableValue::toDerivedPaths() ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#19 0x00007f55e9687723 in nix::build(nix::ref<nix::Store>, nix::ref<nix::Store>, nix::Realise, std::vector<std::shared_ptr<nix::Installable>, std::allocator<std::shared_ptr<nix::Installable> > > const&, nix::BuildMode) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#20 0x0000560ba99b6196 in CmdBuild::run(nix::ref<nix::Store>) ()
#21 0x00007f55e9678050 in nix::StoreCommand::run() ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixcmd.so
#22 0x0000560ba9a3c83f in nix::mainWrapped(int, char**) ()
#23 0x00007f55e9cce678 in nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) ()
   from /nix/store/xz8ayi85xx3i500dfcj8xi5yqxi48ffy-nix-2.5pre20211007_844dd90/lib/libnixmain.so
#24 0x0000560ba99174f6 in main ()
@oxalica oxalica added the bug label Oct 27, 2021
@stale
Copy link

stale bot commented Apr 27, 2022

I marked this as stale due to inactivity. → More info

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

No branches or pull requests

1 participant