digego / extempore

A cyber-physical programming environment
1.4k stars 127 forks source link

Error in `extempore': invalid fastbin entry (free) #235

Closed munshkr closed 8 years ago

munshkr commented 8 years ago

Trying to run (for the first time) Extempore on Ubuntu 14.04. Compilation went ok (both make and make aot), but when running ./extempore I get the following error:

------------- Extempore -------------- 
Andrew Sorensen (c) 2010-2016
andrew@moso.com.au, @digego

ARCH           : x86_64-unknown-linux-gnu
CPU            : sandybridge
ATTRS          : -sse4a -avx512bw +cx16 -tbm -adx -fma4 -avx512vl -prfchw -bmi2 -avx512pf -fsgsbase +avx -avx512cd -rtm +popcnt -fma -bmi -aes -rdrnd +sse4.1 +sse4.2 -avx2 -avx512er +sse -lzcnt +pclmul -avx512f -f16c +ssse3 +mmx +cmov -xop -rdseed -movbe -hle -sha +sse2 +sse3 -avx512dq 
LLVM           : 3.7.0 MCJIT
Output Device  : default
Input Device   : 
SampleRate     : 44100
Channels Out   : 2
Channels In    : 0
Frames         : 128
Latency        : 0.0348299 sec
---------------------------------------

Starting utility process
Trying to connect to 'localhost' on port 7098
New Client Connection 
Successfully connected to remote process

Starting primary process
Trying to connect to 'localhost' on port 7099
New Client Connection 
Successfully connected to remote process
Loading xtmbase library... *** Error in `extempore': invalid fastbin entry (free): 0x00007fd3a416cbf0 ***
Aborted

Is there a way I can debug this? I'm not sure if I'm missing something...

digego commented 8 years ago

A helpful start would be running Extempore in gdb and printing out a backtrace.

Cheers, Andrew.

On Fri, Jan 22, 2016 at 12:56 PM, Damián Silvani notifications@github.com wrote:

Trying to run (for the first time) Extempore on Ubuntu 14.04. Compilation went ok (both make and make aot), but when running ./extempore I get the following error:

------------- Extempore -------------- Andrew Sorensen (c) 2010-2016andrew@moso.com.au, @digego

ARCH : x86_64-unknown-linux-gnu CPU : sandybridge ATTRS : -sse4a -avx512bw +cx16 -tbm -adx -fma4 -avx512vl -prfchw -bmi2 -avx512pf -fsgsbase +avx -avx512cd -rtm +popcnt -fma -bmi -aes -rdrnd +sse4.1 +sse4.2 -avx2 -avx512er +sse -lzcnt +pclmul -avx512f -f16c +ssse3 +mmx +cmov -xop -rdseed -movbe -hle -sha +sse2 +sse3 -avx512dq LLVM : 3.7.0 MCJIT Output Device : default Input Device : SampleRate : 44100 Channels Out : 2 Channels In : 0 Frames : 128

Latency : 0.0348299 sec

Starting utility process Trying to connect to 'localhost' on port 7098 New Client Connection Successfully connected to remote process

Starting primary process Trying to connect to 'localhost' on port 7099 New Client Connection Successfully connected to remote process Loading xtmbase library... * Error in `extempore': invalid fastbin entry (free): 0x00007fd3a416cbf0 * Aborted

Is there a way I can debug this? I'm not sure if I'm missing something...

— Reply to this email directly or view it on GitHub https://github.com/digego/extempore/issues/235.

munshkr commented 8 years ago

Here's the backtrace. For a strange reason it's throwing another kind of error now:

Loading xtmbase library... *** Error in `/home/munshkr/src/extempore/cmake-build/extempore': corrupted double-linked list: 0x00007fffbc0ebd30 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff076e700 (LWP 5873)]
0x00007ffff6b19cc9 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) bt
#0  0x00007ffff6b19cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff6b1d0d8 in __GI_abort () at abort.c:89
#2  0x00007ffff6b56394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff6c64b28 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff6b61c12 in malloc_printerr (ptr=0x7fffbc0ebd30, str=0x7ffff6c60bfc "corrupted double-linked list", action=1) at malloc.c:4996
#4  malloc_consolidate (av=av@entry=0x7fffbc000020) at malloc.c:4157
#5  0x00007ffff6b62df8 in _int_malloc (av=0x7fffbc000020, bytes=1024) at malloc.c:3423
#6  0x00007ffff6b657b0 in __GI___libc_malloc (bytes=1024) at malloc.c:2891
#7  0x00007ffff7422dad in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00000000010852a5 in llvm::DenseMap<void const*, llvm::PassInfo const*, llvm::DenseMapInfo<void const*>, llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*> >::grow(unsigned int) ()
#9  0x0000000001085481 in llvm::PMTopLevelManager::findAnalysisPassInfo(void const*) const ()
#10 0x0000000001088ba8 in llvm::PMTopLevelManager::schedulePass(llvm::Pass*) ()
#11 0x0000000000a42d70 in addPassesToGenerateCode(llvm::LLVMTargetMachine*, llvm::legacy::PassManagerBase&, bool, void const*, void const*, void const*, llvm::MachineFunctionInitializer*) ()
#12 0x0000000000a43b78 in llvm::LLVMTargetMachine::addPassesToEmitMC(llvm::legacy::PassManagerBase&, llvm::MCContext*&, llvm::raw_pwrite_stream&, bool) ()
#13 0x000000000094830f in llvm::MCJIT::emitObject(llvm::Module*) ()
#14 0x0000000000948825 in llvm::MCJIT::generateCodeForModule(llvm::Module*) ()
#15 0x0000000000945cf0 in llvm::MCJIT::finalizeObject() ()
#16 0x00000000005aa695 in extemp::SchemeFFI::jitCompileIRString (_sc=0x7ffff7f40010, args=<optimized out>)
    at /home/munshkr/src/extempore/src/SchemeFFI.cpp:1770
#17 0x000000000059dac2 in opexe_0 (sc=0x7ffff7f40010, op=<optimized out>) at /home/munshkr/src/extempore/src/Scheme.cpp:4049
#18 0x0000000000593f5c in Eval_Cycle (sc=sc@entry=0x7ffff7f40010, op=op@entry=OP_T0LVL) at /home/munshkr/src/extempore/src/Scheme.cpp:6217
#19 0x0000000000594d29 in scheme_load_string (sc=0x7ffff7f40010, cmd=0x7fffbc071a88 "(sys:load \"libs/base/base.xtm\" 'quiet)", start_time=142976, 
    end_time=13372976) at /home/munshkr/src/extempore/src/Scheme.cpp:6684
#20 0x00000000005b536a in extemp::SchemeProcess::impromptu_task_executer (obj_p=0x1934dc0) at /home/munshkr/src/extempore/src/SchemeProcess.cpp:648
#21 0x00007ffff7bc4182 in start_thread (arg=0x7ffff076e700) at pthread_create.c:312
#22 0x00007ffff6bdd47d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb)

edit: Updated backtrace with debugging info (I added a -ggdb flag in CMakeLists.txt flags var)

munshkr commented 8 years ago

OK, I cleaned everything just in case and compiled again (run both make and make aot) and now I get the old invalid fastbin entry (free) error again and can provide a backtrace for this one. It definitely pops up when loading xtmbase.so. If I run ./extempore --nobase it doesn't crash. From looking at the backtrace I thought it was audio-related so I tried --noaudio, but nothing changes. I'll keep looking.

Loading xtmbase library... *** Error in `/home/munshkr/src/extempore/cmake-build/extempore': invalid fastbin entry (free): 0x00007fffd00ed610 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffeb130700 (LWP 20775)]
0x00007ffff6b0fcc9 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) bt
#0  0x00007ffff6b0fcc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff6b130d8 in __GI_abort () at abort.c:89
#2  0x00007ffff6b4c394 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7ffff6c5ab28 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/posix/libc_fatal.c:175
#3  0x00007ffff6b5866e in malloc_printerr (ptr=<optimized out>, str=0x7ffff6c56c46 "invalid fastbin entry (free)", action=1) at malloc.c:4996
#4  _int_free (av=<optimized out>, p=<optimized out>, have_lock=1) at malloc.c:3840
#5  0x00007ffff6b5a3ff in _int_memalign (av=0x7fffd0000020, alignment=140736684021152, bytes=6, bytes@entry=96) at malloc.c:4459
#6  0x00007ffff6b5bc94 in _mid_memalign (alignment=32, bytes=96, address=<optimized out>) at malloc.c:3106
#7  0x00007ffff6b5d8e2 in __posix_memalign (memptr=0x7fffd00d4880, alignment=18446744073709551615, size=20775) at malloc.c:5018
#8  0x000000000057794b in llvm_zone_create (size=<optimized out>) at /home/munshkr/src/extempore/src/EXTLLVM.cpp:413
#9  llvm_zone_malloc (zone=0x7fffd0165a80, size=size@entry=40) at /home/munshkr/src/extempore/src/EXTLLVM.cpp:501
#10 0x0000000000577b45 in add_address_table (zone=<optimized out>, name=0x7fffe9f2a8a0 <gs0> "audio_64bit_adhoc_W2kxXQ", offset=0, 
    type=0x7fffe9f2a8c0 <gs1> "{i8*, i8*, i1 (i8*, i8*)*}**", alloctype=<optimized out>, table=0x0)
    at /home/munshkr/src/extempore/src/EXTLLVM.cpp:1220
#11 0x00007fffe9f1db9b in audio_64bit_adhoc_W2kxXQ_maker () from /home/munshkr/src/extempore/libs/aot-cache/xtmbase.so
#12 0x00007fffd0165a80 in ?? ()
#13 0x0000000000000000 in ?? ()
digego commented 8 years ago

OK, I have a couple of things for you to try:

1) in runtime/llvmti.xtm search for "(define impc:default-zone-size" make sure the value of the define is (* 8 1024) (it might already be this

if the default zone size was set to 0 then try this change first, making sure to rebuild everything after a full clean - also make sure you do a make install. i.e. (make clean; make install; make aot)

if that doesn't help (or zone size was already (* 8 1024)) then try

2) in src/EXTLLVM.cpp search for "int LLVM_ZONE_ALIGN =" if it is set to 32, change it to 16 and do a clean rebuild

3) finally if neither of the above work, then try doing a make clean AND manually delete the directory libs/aot-cache. then try doing a make clean && make install (but DO NOT make aot). You can run Extempore without aot (everything works without aot - just loading times are slower).

Let me know how you get on, and thanks for your persistence, much appreciated!

Cheers, Andrew.

On Sun, Jan 24, 2016 at 12:35 AM, Damián Silvani notifications@github.com wrote:

OK, I cleaned everything just in case and compiled again (run both make and make aot) and now I get the old invalid fastbin entry (free) error again and can provide a backtrace for this one. It definitely pops up when loading xtmbase.so. If I run ./extempore --nobase it doesn't crash. From looking at the backtrace I thought it was audio-related so I tried --noaudio, but nothing changes. I'll keep looking.

Loading xtmbase library... * Error in `/home/munshkr/src/extempore/cmake-build/extempore': invalid fastbin entry (free): 0x00007fffd00ed610 *

Program received signal SIGABRT, Aborted. [Switching to Thread 0x7fffeb130700 (LWP 20775)] 0x00007ffff6b0fcc9 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) bt

0 0x00007ffff6b0fcc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

1 0x00007ffff6b130d8 in __GI_abort () at abort.c:89

2 0x00007ffff6b4c394 in __libc_message (do_abort=doabort@entry=1, fmt=fmt@entry=0x7ffff6c5ab28 "* Error in `%s': %s: 0x%s \n")

at ../sysdeps/posix/libc_fatal.c:175

3 0x00007ffff6b5866e in malloc_printerr (ptr=, str=0x7ffff6c56c46 "invalid fastbin entry (free)", action=1) at malloc.c:4996

4 _int_free (av=, p=, have_lock=1) at malloc.c:3840

5 0x00007ffff6b5a3ff in _int_memalign (av=0x7fffd0000020, alignment=140736684021152, bytes=6, bytes@entry=96) at malloc.c:4459

6 0x00007ffff6b5bc94 in _mid_memalign (alignment=32, bytes=96, address=) at malloc.c:3106

7 0x00007ffff6b5d8e2 in __posix_memalign (memptr=0x7fffd00d4880, alignment=18446744073709551615, size=20775) at malloc.c:5018

8 0x000000000057794b in llvm_zone_create (size=) at /home/munshkr/src/extempore/src/EXTLLVM.cpp:413

9 llvm_zone_malloc (zone=0x7fffd0165a80, size=size@entry=40) at /home/munshkr/src/extempore/src/EXTLLVM.cpp:501

10 0x0000000000577b45 in add_address_table (zone=, name=0x7fffe9f2a8a0 "audio_64bit_adhoc_W2kxXQ", offset=0,

type=0x7fffe9f2a8c0 <gs1> "{i8_, i8_, i1 (i8_, i8_)_}**", alloctype=<optimized out>, table=0x0)
at /home/munshkr/src/extempore/src/EXTLLVM.cpp:1220

11 0x00007fffe9f1db9b in audio_64bit_adhoc_W2kxXQ_maker () from /home/munshkr/src/extempore/libs/aot-cache/xtmbase.so

12 0x00007fffd0165a80 in ?? ()

13 0x0000000000000000 in ?? ()

— Reply to this email directly or view it on GitHub https://github.com/digego/extempore/issues/235#issuecomment-174190448.

munshkr commented 8 years ago

1) in runtime/llvmti.xtm search for "(define impc:default-zone-size" make sure the value of the define is (* 8 1024) (it might already be this - or it might be set to 0)

if the default zone size was set to 0 then try this change first, making sure to rebuild everything after a full clean - also make sure you do a make install. i.e. (make clean; make install; make aot)

That worked :-) Thanks! Do you want me try something else?

digego commented 8 years ago

Ok, great. No need to try anything else if that solved the problem.

Thanks again for your patience! Please let me know how you get on.

I'll push a fix sometime this week. When the fix hits head I will close this report. You should get an email when this happens, and that would be a good time to pull from head again (and clean/rebuild again - sorry ;) Until then you should be fine to keep going with your current build

On Sun, Jan 24, 2016 at 9:36 AM, Damián Silvani notifications@github.com wrote:

1) in runtime/llvmti.xtm search for "(define impc:default-zone-size" make sure the value of the define is (* 8 1024) (it might already be this - or it might be set to 0)

if the default zone size was set to 0 then try this change first, making sure to rebuild everything after a full clean - also make sure you do a make install. i.e. (make clean; make install; make aot)

That worked :-) Thanks! Do you want me try something else?

— Reply to this email directly or view it on GitHub https://github.com/digego/extempore/issues/235#issuecomment-174234324.

digego commented 8 years ago

should now be fixed in head. please let me know if it isn't!!