Opened 8 years ago

Closed 8 years ago

#1076 closed defect (can't reproduce)

Signs of memory leak during toolshed install

Reported by: Tristan Croll Owned by: Conrad Huang
Priority: moderate Milestone:
Component: Tool Shed Version:
Keywords: Cc: Tom Goddard
Blocked By: Blocking:
Notify when closed: Platform: Linux64 (X11)
Project: ChimeraX

Description

OK, this is doing my head in somewhat. In my ISOLDE source, if I add

from simtk import openmm

to my top-level init.py (not what I was doing originally, but what it boils down to), then on running make app-install in Linux, at the end of an otherwise successful installation I get a traceback (the details of which I've copied below), indicating that something is trying to free up memory that's already been freed (and probably doesn't belong to it).

Executing: toolshed install './dist/ChimeraX_ISOLDE-0.9.24-cp36-cp36m-linux_x86_64.whl' reinstall true
unloading module chimerax.isolde
Successfully installed ChimeraX-ISOLDE-0.9.24
Installed ChimeraX-ISOLDE (0.9.24)

Executing: exit
Exiting ...
*** Error in `/home/tic20/apps/chimerax/bin/ChimeraX': double free or corruption (!prev): 0x0000000002b8fab0 ***
======= Backtrace: =========

Last entry in the log when running under Valgrind:

==2079== Invalid free() / delete / delete[] / realloc()
==2079==    at 0x4C2B18D: operator delete(void*) (vg_replace_malloc.c:576)
==2079==    by 0x5BCFA68: __run_exit_handlers (exit.c:77)
==2079==    by 0x5BCFAB4: exit (exit.c:99)
==2079==    by 0x4FCC4A8: Py_Exit (pylifecycle.c:1550)
==2079==    by 0x4FCF5E3: handle_system_exit.part.3 (pythonrun.c:626)
==2079==    by 0x4FCF974: handle_system_exit (pythonrun.c:658)
==2079==    by 0x4FCF974: PyErr_PrintEx (pythonrun.c:636)
==2079==    by 0x4FEC4AC: RunModule (main.c:215)
==2079==    by 0x4FED080: Py_Main (main.c:750)
==2079==    by 0x4008C2: main (in /home/tic20/apps/chimerax/bin/ChimeraX)
==2079==  Address 0xd233d30 is 0 bytes inside a block of size 1,194 free'd
==2079==    at 0x4C2B18D: operator delete(void*) (vg_replace_malloc.c:576)
==2079==    by 0x5BCFA68: __run_exit_handlers (exit.c:77)
==2079==    by 0x5BCFAB4: exit (exit.c:99)
==2079==    by 0x4FCC4A8: Py_Exit (pylifecycle.c:1550)
==2079==    by 0x4FCF5E3: handle_system_exit.part.3 (pythonrun.c:626)
==2079==    by 0x4FCF974: handle_system_exit (pythonrun.c:658)
==2079==    by 0x4FCF974: PyErr_PrintEx (pythonrun.c:636)
==2079==    by 0x4FEC4AC: RunModule (main.c:215)
==2079==    by 0x4FED080: Py_Main (main.c:750)
==2079==    by 0x4008C2: main (in /home/tic20/apps/chimerax/bin/ChimeraX)
==2079==  Block was alloc'd at
==2079==    at 0x4C2A203: operator new(unsigned long) (vg_replace_malloc.c:334)
==2079==    by 0x5432158: allocate (new_allocator.h:104)
==2079==    by 0x5432158: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (basic_string.tcc:607)
==2079==    by 0x5433AD4: char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) (basic_string.tcc:138)
==2079==    by 0x5433F05: _S_construct_aux<char const*> (basic_string.h:1743)
==2079==    by 0x5433F05: _S_construct<char const*> (basic_string.h:1764)
==2079==    by 0x5433F05: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (basic_string.tcc:215)
==2079==    by 0x76611F93: __cxx_global_var_init.3 (OpenCLDrudeKernelSources.cpp:290)
==2079==    by 0x76611F93: _GLOBAL__sub_I_OpenCLDrudeKernelSources.cpp (OpenCLDrudeKernelSources.cpp:0)
==2079==    by 0x400F4C2: call_init (dl-init.c:82)
==2079==    by 0x400F4C2: _dl_init (dl-init.c:131)
==2079==    by 0x4013BD5: dl_open_worker (dl-open.c:560)
==2079==    by 0x400F2D3: _dl_catch_error (dl-error.c:177)
==2079==    by 0x40132CA: _dl_open (dl-open.c:650)
==2079==    by 0x6176FBA: dlopen_doit (dlopen.c:66)
==2079==    by 0x400F2D3: _dl_catch_error (dl-error.c:177)
==2079==    by 0x61775BC: _dlerror_run (dlerror.c:163)

Looking through the full valgrind log, I can't find anything relating to any of my own classes (none of which should have been instantiated in any case) in amongst all the general Python spam. The installation itself works: I can start ChimeraX and ISOLDE, run a simulation, apply all my different restraints, and shut down without error. Furthermore, the error doesn't appear on the Mac. Really not sure where to take it from here.

On another note, I find that if I remove the offending line, I have to run make app-install twice before the traceback goes away - not sure if this is by design or not, but it seems the existing bundle installation is loaded during the installation of the new one.

Change History (2)

comment:1 by Tristan Croll, 8 years ago

Still not sure exactly what was going on here, but after deleting my .local/share/ChimeraX/0.6 directory and rebuilding the problem seems to have disappeared.

comment:2 by Tristan Croll, 8 years ago

Resolution: can't reproduce
Status: assignedclosed

Still not sure what was going on here, but it's not coming back. Nearest guess is that I accidentally installed a version of ISOLDE built against an older ChimeraX build, and make clean wasn't fully clearing it up. Wiping just the ISOLDE directory from .local/share/ChimeraX/0.6 wasn't enough, either - but after wiping the whole tree and starting afresh, the problem seems to be gone for good.

Note: See TracTickets for help on using tickets.