Skip to content

Memory problems #231

Closed
Closed

Description

@vcunat

I finally got to valgrinding nix because of http://hydra.nixos.org/build/9629029. Would someone knowledgeable in nix internals look at it? CC @edolstra @shlevy

I only found the problem when running the timeout test, command /nix/store/ymgzxx2ng3ziv8ps3db2ylfnifyp37yf-nix-1.6.1/bin/nix-store --add-root ./result --indirect -r --option build-max-log-s ize 100 /tmp/nix-build-nix-1.6.1.drv-2/nix-1.6.1/tests/test-tmp/store/cdbjyhrsk1w8kfg3nbkn261dh15hcjw7-timeout.drv!out

The relevant parts seem to be:

==26137== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==26137==    at 0x5CEC4BE: __libc_sigaction (in /nix/store/94n64qy99ja0vgbkf675nyk39g9b978n-glibc-2.19/lib/libpthread-2.19.so)
==26137==    by 0x50E14EC: nix::restoreSIGPIPE() (build.cc:417)
==26137==    by 0x50EE623: nix::DerivationGoal::initChild() (build.cc:2248)
==26137==    by 0x50EC421: nix::DerivationGoal::startBuilder() (build.cc:2062)
==26137==    by 0x50E7223: nix::DerivationGoal::tryToBuild() (build.cc:1398)
==26137==    by 0x50E46CE: nix::DerivationGoal::work() (build.cc:1008)
==26137==    by 0x50F5EEA: nix::Worker::run(std::set<boost::shared_ptr<nix::Goal>, std::less<boost::shared_ptr<nix::Goal> >, std::allocator<boost
::shared_ptr<nix::Goal> > > const&) (build.cc:3142)
==26137==    by 0x50F77B8: nix::LocalStore::buildPaths(std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool) 
(build.cc:3329)
==26137==    by 0x412A92: opRealise(std::list<std::string, std::allocator<std::string> >, std::list<std::string, std::allocator<std::string> >) (
nix-store.cc:137)
==26137==    by 0x41A0E7: run(std::list<std::string, std::allocator<std::string> >) (nix-store.cc:921)
==26137==    by 0x4E3C96F: nix::initAndRun(int, char**) (shared.cc:230)
==26137==    by 0x4E3D078: main (shared.cc:284)
==26137==  Address 0xffefedcb8 is on thread 1's stack
==26137== 
==26133== Invalid write of size 8
==26133==    at 0x50F6E19: nix::Worker::waitForInput() (build.cc:3267)
==26133==    by 0x50F603A: nix::Worker::run(std::set<boost::shared_ptr<nix::Goal>, std::less<boost::shared_ptr<nix::Goal> >, std::allocator<boost::shared_ptr<nix::Goal> > > const&) (build.cc:3151)
==26133==    by 0x50F77B8: nix::LocalStore::buildPaths(std::set<std::string, std::less<std::string>, std::allocator<std::string> > const&, bool) (build.cc:3329)
==26133==    by 0x412A92: opRealise(std::list<std::string, std::allocator<std::string> >, std::list<std::string, std::allocator<std::string> >) (nix-store.cc:137)
==26133==    by 0x41A0E7: run(std::list<std::string, std::allocator<std::string> >) (nix-store.cc:921)
==26133==    by 0x4E3C96F: nix::initAndRun(int, char**) (shared.cc:230)
==26133==    by 0x4E3D078: main (shared.cc:284)
==26133==  Address 0x7a3dfe0 is 112 bytes inside a block of size 128 free'd
==26133==    at 0x4C27951: operator delete(void*) (in /nix/store/4g2m964cc2rma46m5fc0x8bz2qaw2krn-valgrind-3.9.0/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26133==    by 0x51095E3: __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, nix::Child> > >::deallocate(std::_Rb_tree_node<std::pair<int const, nix::Child> >*, unsigned long) (new_allocator.h:110)
==26133==    by 0x5107AAD: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::_M_put_node(std::_Rb_tree_node<std::pair<int const, nix::Child> >*) (stl_tree.h:374)
==26133==    by 0x510549A: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::_M_destroy_node(std::_Rb_tree_node<std::pair<int const, nix::Child> >*) (stl_tree.h:396)
==26133==    by 0x5101FC0: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::_M_erase(std::_Rb_tree_node<std::pair<int const, nix::Child> >*) (stl_tree.h:1127)
==26133==    by 0x5109CF8: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::clear() (stl_tree.h:860)
==26133==    by 0x51089BF: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::_M_erase_aux(std::_Rb_tree_const_iterator<std::pair<int const, nix::Child> >, std::_Rb_tree_const_iterator<std::pair<int const, nix::Child> >) (stl_tree.h:1757)
==26133==    by 0x5105EF6: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::erase(std::_Rb_tree_iterator<std::pair<int const, nix::Child> >, std::_Rb_tree_iterator<std::pair<int const, nix::Child> >) (stl_tree.h:848)
==26133==    by 0x51027F9: std::_Rb_tree<int, std::pair<int const, nix::Child>, std::_Select1st<std::pair<int const, nix::Child> >, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::erase(int const&) (stl_tree.h:1771)
==26133==    by 0x50FFB10: std::map<int, nix::Child, std::less<int>, std::allocator<std::pair<int const, nix::Child> > >::erase(int const&) (stl_map.h:727)
==26133==    by 0x50F5897: nix::Worker::childTerminated(int, bool) (build.cc:3086)
==26133==    by 0x50E44BC: nix::DerivationGoal::killChild() (build.cc:971)

Activity

  1. self-assigned this
    on Mar 29, 2014
  2. added a commit that references this issue on Mar 29, 2014
  3. vcunat commented on Mar 29, 2014

    @vcunat
    MemberAuthor
  4. edolstra commented on Mar 29, 2014

    @edolstra
    Member

    Done.

  5. edolstra commented on Mar 29, 2014

    @edolstra
    Member

    Note btw that I said "probably fixes" in my commit message, but GitHub doesn't parse "probably" :-)

  6. vcunat commented on Mar 30, 2014

    @vcunat
    MemberAuthor

    I planned to re-run the valgrind tests again anyway, probably today.

  7. vcunat commented on Mar 31, 2014

    @vcunat
    MemberAuthor

    I verified that valgrind warnings are gone for the timeout test (on 034b6f6; except for GC-related ones, but I ignore those). Also I tried a full nix build 16-times and I got no segfault (same branch as was failing on Hydra, except for updated nix).

  8. added a commit that references this issue on Jan 1, 2024
  9. added a commit that references this issue on Jul 11, 2024
    2a98fe2
  10. added a commit that references this issue on Feb 26, 2025
  11. added a commit that references this issue on Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions