Bug #1920
malloc() error: smallbin double linked list corrupted
Description
GROMACS version 5.1.2 (but 5.0.6 gives the same result) under Ubuntu 14.04.3 LTS
The error appears when executing:
gmx dielectric -ffn aexp
on a dipcorr.xvg file longer than a few timesteps. For example:
$ gmx dielectric -ffn aexp Read data set containing 2 colums and 1001 rows Assuming (from data) that timestep is 10, nxtail = 50 Creating standard deviation numbers ... nbegin = 1, x[nbegin] = 10, tbegin = 5 *** Error in `gmx': malloc(): smallbin double linked list corrupted: 0x000000000078b730 *** Aborted (core dumped)
After reducing the dipcorr.xvg file to a few timesteps (dipcorr.xvg copied to correl.xvg and edited by hand), the command works correctly:
$ gmx dielectric -ffn aexp -f correl.xvg Read data set containing 2 colums and 11 rows Assuming (from data) that timestep is 10, nxtail = 11 Creating standard deviation numbers ... nbegin = 1, x[nbegin] = 10, tbegin = 5 Step chi^2 Lambda A1 A2 A3 A4 irow = 2, icol = 2 -nan -nan -nan 0.000 Numerical Recipes run-time error... GAUSSJ: Singular Matrix-2 Fit failed! DATA INTEGRAL: 0.0, tauD(old) = 0.0 ps, tau_slope = 0.0, tau_slope,D = 0.0 ps tau_D from tau1 = 2.33e-38 , eps(Infty) = 80.000 nbegin = 1, x[nbegin] = 10, tbegin = 5 Making smooth transition from 1 through 4 SMOOTH integral = 1.09961e+01 FIT INTEGRAL (tau_M): 11.0, tau_D = 16.5 Doing FFT of 32 points MAXEPS = 3.40426e+01 at frequency 1.25000e+01 GHz (tauD = 12.7 ps) gcq#17: "I Calculate My Birthright" (P.J. Harvey)
I have tried to recompile gromacs 5.1.2 with debugging options, and to execute gmx under gdb:
$ gdb gmx GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from gmx...done. (gdb) run dielectric Starting program: /home/roberto/MD/gromacs-5.1.2/build1/bin/gmx dielectric [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". :-) GROMACS - gmx dielectric, VERSION 5.1.2 (-: GROMACS is written by: Emile Apol Rossen Apostolov Herman J.C. Berendsen Par Bjelkmar Aldert van Buuren Rudi van Drunen Anton Feenstra Sebastian Fritsch Gerrit Groenhof Christoph Junghans Anca Hamuraru Vincent Hindriksen Dimitrios Karkoulis Peter Kasson Jiri Kraus Carsten Kutzner Per Larsson Justin A. Lemkul Magnus Lundborg Pieter Meulenhoff Erik Marklund Teemu Murtola Szilard Pall Sander Pronk Roland Schulz Alexey Shvetsov Michael Shirts Alfons Sijbers Peter Tieleman Teemu Virolainen Christian Wennberg Maarten Wolf and the project leaders: Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel Copyright (c) 1991-2000, University of Groningen, The Netherlands. Copyright (c) 2001-2015, The GROMACS development team at Uppsala University, Stockholm University and the Royal Institute of Technology, Sweden. check out http://www.gromacs.org for more information. GROMACS is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. GROMACS: gmx dielectric, VERSION 5.1.2 Executable: /home/roberto/MD/gromacs-5.1.2/build1/bin/gmx Data prefix: /home/roberto/MD/gromacs-5.1.2 (source tree) Command line: gmx dielectric ++++ PLEASE READ AND CITE THE FOLLOWING REFERENCE ++++ D. van der Spoel and P. J. van Maaren and H. J. C. Berendsen A systematic study of water models for molecular simulation. Derivation of models optimized for use with a reaction-field. J. Chem. Phys. 108 (1998) pp. 10220-10230 -------- -------- --- Thank You --- -------- -------- WARNING: non-polarizable models can never yield an infinite dielectric constant that is different from 1. This is incorrect in the reference given above (Spoel98a). Read data set containing 2 colums and 1001 rows Assuming (from data) that timestep is 10, nxtail = 50 Creating standard deviation numbers ... nbegin = 1, x[nbegin] = 10, tbegin = 5 There are 50 data points, 0 parameters, initial chi2 = 0.0581182 params: *** Error in `/home/roberto/MD/gromacs-5.1.2/build1/bin/gmx': malloc(): smallbin double linked list corrupted: 0x000000000064d060 *** Program received signal SIGABRT, Aborted. 0x00007ffff4d87cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) where #0 0x00007ffff4d87cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff4d8b0d8 in __GI_abort () at abort.c:89 #2 0x00007ffff4dc4394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff4ed2b28 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #3 0x00007ffff4dcf0f7 in malloc_printerr (action=<optimized out>, str=0x7ffff4ed2ef0 "malloc(): smallbin double linked list corrupted", ptr=<optimized out>) at malloc.c:4996 #4 0x00007ffff4dd1e04 in _int_malloc ( av=av@entry=0x7ffff510f760 <main_arena>, bytes=bytes@entry=24) at malloc.c:3359 #5 0x00007ffff4dd42cc in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:3219 #6 0x00007ffff5cdaca4 in save_calloc (name=0x7ffff79db453 "status", file=0x7ffff79db408 "/home/roberto/MD/gromacs-5.1.2/src/gromacs/correlationfunctions/expfit.cpp", line=458, nelem=1, elsize=24) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/utility/smalloc.c:180 #7 0x00007ffff5f06c54 in gmx_snew_impl<lm_status_struct> ( name=0x7ffff79db453 "status", file=0x7ffff79db408 "/home/roberto/MD/gromacs-5.1.2/src/gromacs/correlationfunctions/expfit.cpp", line=458, ptr=@0x7fffffffdc48: 0x7ffff4dc25c9 <fputc+185>, nelem=1) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/utility/smalloc.h:225 #8 0x00007ffff5f04b01 in lmfit_exp (nfit=50, x=0x659cc0, y=0x65bc10, dy=0x65db60, parm=0x64c620, bVerbose=1, eFitFn=0, nfix=0) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/correlationfunctions/expfit.cpp:458 #9 0x00007ffff5f05b1e in do_lmfit (ndata=1001, c1=0x654e50, sig=0x655e00, dt=10, x0=0x64fe20, begintimefit=5, endtimefit=500, oenv=0x64fc20, bVerbose=1, eFitFn=0, fitparms=0x64c620, fix=0, fn_fitted=0x0) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/correlationfunctions/expfit.cpp:768 #10 0x00007ffff5d5d836 in gmx_dielectric (argc=1, argv=0x7fffffffe430) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/gmxana/gmx_dielectric.c:399 #11 0x00007ffff5bfd691 in gmx::(anonymous namespace)::CMainCommandLineModule::run (this=0x643ff0, argc=1, argv=0x7fffffffe430) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/commandline/cmdlinemodulemanager.cpp:125 #12 0x00007ffff5bfee26 in gmx::CommandLineModuleManager::run ( this=0x7fffffffe300, argc=1, argv=0x7fffffffe430) at /home/roberto/MD/gromacs-5.1.2/src/gromacs/commandline/cmdlinemodulemanager.cpp:554 #13 0x00000000004115b3 in main (argc=2, argv=0x7fffffffe428) at /home/roberto/MD/gromacs-5.1.2/src/programs/gmx.cpp:60
Navigating in the WEB, the "double linked list corrupted" error appears to be a subtle error, related to a wrong malloc() allocation of a pointer to pointer, for example:
a=(char **)malloc(nl);
instead of
a=(char **)malloc( nl * sizeof(char*) );
Associated revisions
History
#1 Updated by Mark Abraham almost 5 years ago
- Description updated (diff)
#2 Updated by David van der Spoel almost 5 years ago
- Assignee set to David van der Spoel
Can you please upload a dipcorr file that gives this problem?
#3 Updated by Roberto Olmi almost 5 years ago
- File dipcorr.xvg dipcorr.xvg added
gmx dielectric -ffn aexp gives the mentioned error.
gmx dielectric -ffn aexp -f correl.xvg, on the reduced file correl.xvg (first 200 ps), works well.
#4 Updated by Roberto Olmi almost 5 years ago
- File correl.xvg correl.xvg added
#5 Updated by David van der Spoel almost 5 years ago
I reproduced the problem on Linux (but it is fine on mac osx). Will have a look.
#6 Updated by Gerrit Code Review Bot almost 5 years ago
Gerrit received a related patchset '1' for Issue #1920.
Uploader: David van der Spoel (davidvanderspoel@gmail.com)
Change-Id: I3f35f0af3f56d33435bf54a9c7cda6273fb3f05a
Gerrit URL: https://gerrit.gromacs.org/5740
#7 Updated by David van der Spoel almost 5 years ago
- Status changed from New to Resolved
Applied in changeset 1e130c8cd6230f96500162e55972023257ffeffa.
#8 Updated by Szilárd Páll almost 5 years ago
- Target version set to 5.1.3
#9 Updated by David van der Spoel almost 5 years ago
- Status changed from Resolved to Closed
Removed srenew that was making array smaller incorrectly.
An array y was first allocated to 6 entries, then reduced
to 3 entries using srenew, but after that the indices
3, 4 and 5 were used anyway. Removing the srenew fixes the probem.
Fixes #1920
Change-Id: I3f35f0af3f56d33435bf54a9c7cda6273fb3f05a