"double free or corruption" error with lammps-11Jan13

Hi

I've compiled the 11Jan13 version of LAMMPS with g++ 4.6.3, OpenMPI
1.6.3, and FFTW 3.3.3 on a a workstation with Intel Xeon E5645
processors running Ubuntu 12.04.1 LTS.

The compilation does not give any errors, but when I run the example
calculation in examples/peptide with mpirun on 4 processors, the
simulation runs to the end but then gives a "double free or
corruption" error right at the end.

I've also run the example calculations in examples/xxxx, where xxxx=
melt, dreiding, colloid, dipole, eim, ellipse, flow, friction,
micelle, and nemd and don't get any error.

I've also compiled a serial version of the executable to run without
OpenMPI, which was also compiled without any of the CCFLAGS in the
Makefile below except for '-O2', and get the same error.

I've also compiled the 23Jun12 version of LAMMPS with the same
versions of the compiler, OpenMPI, FFTW and with the same compiler
flags as in the Makefile below and do not get the "double free or
corruption" error when I run the example calculation in
examples/peptide.

Is this a possible bug with the 11Jan13 version? I found a previous
post to this list in which this error was due to a bug:

http://lammps.sandia.gov/threads/msg19231.html

Below are my Makefile and the screen output for the examples/peptide
calculation:

# theochem_openmpi-gnu = Ubuntu Linux, gnu compilers, OPENMPI, FFTW3

SHELL = /bin/sh

# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler

CC = mpic++
CCFLAGS = -O2 -fomit-frame-pointer -fno-rtti -fno-exceptions \
                -march=native -ffast-math -mpc64 -finline-functions \
                -funroll-loops -fstrict-aliasing
SHFLAGS = -fPIC
DEPFLAGS = -M

LINK = mpic++
LINKFLAGS = -O
LIB =
SIZE = size

ARCHIVE = ar
ARFLAGS = -rc
SHLIBFLAGS = -shared

# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use
# if you change any -D setting, do full re-compile after "make clean"

# LAMMPS ifdef settings, OPTIONAL
# see possible settings in doc/Section_start.html#2_2 (step 4)

LMP_INC = -DLAMMPS_GZIP

# MPI library, REQUIRED
# see discussion in doc/Section_start.html#2_2 (step 5)
# can point to dummy MPI library in src/STUBS as in Makefile.serial
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library

MPI_INC =
MPI_PATH =
MPI_LIB =

# FFT library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 6)
# can be left blank to use provided KISS FFT library
# INC = -DFFT setting, e.g. -DFFT_FFTW, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library

FFT_HOME = /opt/fftw/3.3.3/gnu

FFT_INC = -DFFT_FFTW3 -I${FFT_HOME}/include
FFT_PATH = -L${FFT_HOME}/lib
FFT_LIB = -lfftw3 -lfftw3_mpi -lm

# JPEG library, OPTIONAL
# see discussion in doc/Section_start.html#2_2 (step 7)
# only needed if -DLAMMPS_JPEG listed with LMP_INC
# INC = path for jpeglib.h
# PATH = path for JPEG library
# LIB = name of JPEG library

JPG_INC =
JPG_PATH =
JPG_LIB =

# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section

include Makefile.package.settings
include Makefile.package

EXTRA_INC = \(LMP\_INC\) (PKG_INC) \(MPI\_INC\) (FFT_INC) \(JPG\_INC\) (PKG_SYSINC)
EXTRA_PATH = \(PKG\_PATH\) (MPI_PATH) \(FFT\_PATH\) (JPG_PATH) \(PKG\_SYSPATH\) EXTRA\_LIB = (PKG_LIB) \(MPI\_LIB\) (FFT_LIB) \(JPG\_LIB\) (PKG_SYSLIB)

# Link target

\(EXE\): (OBJ)
        \(LINK\) (LINKFLAGS) \(EXTRA\_PATH\) (OBJ) \(EXTRA\_LIB\) (LIB) -o \(EXE\)         (SIZE) $(EXE)

# Library targets

lib: \(OBJ\)         (ARCHIVE) \(ARFLAGS\) (EXE) $(OBJ)

shlib: \(OBJ\)         (CC) \(CCFLAGS\) (SHFLAGS) \(SHLIBFLAGS\) (EXTRA_PATH) -o \(EXE\) \\         (OBJ) \(EXTRA\_LIB\) (LIB)

# Compilation rules

\.o:.cpp
        \(CC\) (CCFLAGS) \(SHFLAGS\) (EXTRA_INC) -c $<

\.d:.cpp
        \(CC\) (CCFLAGS) \(EXTRA\_INC\) (DEPFLAGS) &lt; &gt; @

# Individual dependencies

DEPENDS = \(OBJ:\.o=\.d\) sinclude (DEPENDS)

Hi

I've compiled the 11Jan13 version of LAMMPS with g++ 4.6.3, OpenMPI
1.6.3, and FFTW 3.3.3 on a a workstation with Intel Xeon E5645
processors running Ubuntu 12.04.1 LTS.

The compilation does not give any errors, but when I run the example
calculation in examples/peptide with mpirun on 4 processors, the
simulation runs to the end but then gives a "double free or
corruption" error right at the end.

i cannot reproduce this with the current version through git.
there were a few commits since the last download version,
so one of those changes may already fix the problem.

I've also run the example calculations in examples/xxxx, where xxxx=
melt, dreiding, colloid, dipole, eim, ellipse, flow, friction,
micelle, and nemd and don't get any error.

hmmm, the peptide example uses a different output format
for thermodynamic output and the stacktrace seems to be
coming from the Thermo class.

I've also compiled a serial version of the executable to run without
OpenMPI, which was also compiled without any of the CCFLAGS in the
Makefile below except for '-O2', and get the same error.

I've also compiled the 23Jun12 version of LAMMPS with the same
versions of the compiler, OpenMPI, FFTW and with the same compiler
flags as in the Makefile below and do not get the "double free or
corruption" error when I run the example calculation in
examples/peptide.

Is this a possible bug with the 11Jan13 version? I found a previous
post to this list in which this error was due to a bug:

possibly, and it is possibly fixed in the svn/git repository already.
try grabbing this file from the git repo and see if that fixes it.
http://git.icms.temple.edu/git/?p=lammps-ro.git;a=blob_plain;f=src/thermo.cpp;hb=ec624ab44689d833b32d32bf42ecba47c2ca1012

cheers,
     axel.

Thanks, Axel. I downloaded the updated version of thermo.cpp from the
git repository and the peptide example runs without error now.

I ran "diff thermo.cpp thermo.cpp-", where thermo.cpp- is the version
of the file in the installation that was giving errors and got the
following:

57d56
< // also insure allocation of line string is correct in constructor
91a91,99

  // line string used for 3 tasks
  // concat of custom style args
  // one-time thermo output of header line
  // each line of numeric thermo output
  // 256 = extra for ONE or MULTI string or multi formatting
  // 32 = max per-arg chars in header or numeric output

  line = new char[256+32*narg];

95,100d102
< // allocate line string used for 3 tasks
< // concat of custom style args
< // one-time thermo output of header line
< // each line of numeric thermo output
< // 256 = extra for ONE or MULTI string or multi formatting
< // 64 = max per-arg chars in header or numeric output
103d104
< line = new char[256+6*64];
106d106
< line = new char[256+12*64];
112d111
< line = new char[256+narg*64];

I guess defining "line = new char[256+32*narg]" in the original
version of the code instead of "line = new char[256+12*64]" in the
updated version for thermo_style multi doesn't provide an array of
sufficient size.

David

yes - that but was caught quickly, and is in the
repo, but may not have appeared in a patch.

Steve