JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.58k stars 5.48k forks source link

Tab-Expansion of Base in REPL causes SIGABRT #2064

Closed staticfloat closed 11 years ago

staticfloat commented 11 years ago
$ gdb ./julia
...
julia> Base.<TAB>
<Begins displaying properly>
<Right around Base.@sprintf, things start to go crazy>

Program received signal SIGABRT, Aborted.
0x00007fff8978a212 in __pthread_kill ()
(gdb) bt
#0  0x00007fff8978a212 in __pthread_kill ()
#1  0x00007fff8b030af4 in pthread_kill ()
#2  0x00007fff8b074dce in abort ()
#3  0x00007fff8b0508a5 in szone_error ()
#4  0x00007fff8b056819 in small_malloc_from_free_list ()
#5  0x00007fff8b056406 in szone_malloc_should_clear ()
#6  0x00007fff8b048153 in malloc_zone_malloc ()
#7  0x00007fff8b048ba7 in malloc ()
#8  0x00000001008c4031 in llvm::MallocSlabAllocator::Allocate ()
#9  0x00000001008c3c20 in llvm::BumpPtrAllocator::Allocate ()
#10 0x000000010053c616 in llvm::ScopedHashTable<llvm::Value*, std::pair<llvm::Value*, unsigned int>, llvm::DenseMapInfo<llvm::Value*>, llvm::RecyclingAllocator<llvm::BumpPtrAllocator, llvm::ScopedHashTableVal<llvm::Value*, std::pair<llvm::Value*, unsigned int> >, 40ul, 8ul> >::insertIntoScope ()
#11 0x00000001005393a6 in (anonymous namespace)::EarlyCSE::runOnFunction ()
#12 0x0000000100894670 in llvm::FPPassManager::runOnFunction ()
#13 0x0000000100893f95 in llvm::FunctionPassManagerImpl::run ()
#14 0x0000000100893ea5 in llvm::FunctionPassManager::run ()
#15 0x0000000100062cc2 in to_function ()
#16 0x0000000100062bcd in jl_compile ()
#17 0x00000001000606eb in jl_trampoline ()
#18 0x0000000101e26a03 in ?? ()
#19 0x0000000101e2692a in ?? ()
#20 0x000000010005b173 in jl_apply_generic ()
#21 0x000000010009b5a8 in jl_callback_call ()
#22 0x000000010009c04d in jl_asynccb ()
#23 0x00000001000bdee8 in uv__async_io (loop=0x100c4cb58, w=0x100c4ccd8, events=1) at src/unix/async.c:142
#24 0x00000001000d7b45 in uv__io_poll (loop=0x100c4cb58, timeout=10000) at src/unix/kqueue.c:221
#25 0x00000001000be778 in uv__run (loop=0x100c4cb58) at src/unix/core.c:271
#26 0x00000001000be705 in uv_run (loop=0x100c4cb58) at src/unix/core.c:279
#27 0x0000000101e0d891 in ?? ()
#28 0x0000000101e0d527 in ?? ()
#29 0x000000010005b173 in jl_apply_generic ()
#30 0x0000000101e0d486 in ?? ()
#31 0x0000000100094ebf in start_task ()
#32 0x0000000100093d2a in julia_trampoline ()
#33 0x00000001000018a9 in main ()
staticfloat commented 11 years ago

Interestingly, building a Debug version and running that inside of gdb doesn't crash, although the text layout does still go crazy.

JeffBezanson commented 11 years ago

I don't get a crash, but it definitely behaves oddly. The Display all 1860 possibilities? message appears, but before I can answer it starts printing all the completions, leaving the terminal in a strange state. This only seems to happen in cases with enough completions to print that message. Surely there is something unhealthy about telling readline to read from /dev/null. @vtjnash

johnmyleswhite commented 11 years ago

Thanks for looking into this.

staticfloat commented 11 years ago

It appears that the segfault only happens when running Julia inside of tmux. Running julia inside tmux results in output that looks like this: http://i.imgur.com/t58hFus.png

This is after typing "Base."

JeffBezanson commented 11 years ago

@vtjnash Unfortunately I don't see a simple way to fix this within the current framework. We have readline'd ourselves into a corner.

vtjnash commented 11 years ago

it certainly seems that way. i'm seeing if we can feed readline with a pipe (created by libuv) instead of rl_stuff_char.

vtjnash commented 11 years ago

seems like the best thing to do is comment out the /dev/null stdin redirection for the v0.1 release, until we can replace readline

staticfloat commented 11 years ago

This has been fixed for me. Can anyone else reproduce this error? Otherwise I will close.

railskipl commented 11 years ago

This i what i am getting,,

Program received signal SIGABRT, Aborted.
0x96a63a6a in __pthread_kill ()
(gdb) bt
#0  0x96a63a6a in __pthread_kill ()
#1  0x9590bacf in pthread_kill ()
#2  0x0391357b in abort ()
#3  0x03825f7b in abort_message ()
#4  0x03823a25 in default_terminate ()
#5  0x006170c1 in _objc_terminate ()
#6  0x03775652 in std::terminate ()
#7  0x00617039 in objc_terminate ()
#8  0x038a4027 in _dispatch_client_callout ()
#9  0x038947d5 in _dispatch_main_queue_callback_4CF ()
#10 0x02448af5 in __CFRunLoopRun ()
#11 0x02447f44 in CFRunLoopRunSpecific ()
#12 0x02447e1b in CFRunLoopRunInMode ()
#13 0x0403c7e3 in GSEventRunModal ()
#14 0x0403c668 in GSEventRun ()
#15 0x0098465c in UIApplicationMain ()
#16 0x000a5187 in main ()

[pao: formatting]

pao commented 11 years ago

Our poor early issues. @railskipl, just a heads up, be sure you code-quote (single backtick inline, triple backtick for block) console output and Julia code, since the GitHub autolinker may otherwise drop cross-references in unrelated issues (as it did here with the #nn from the backtrace) or ping random people whose usernames happen to match the names of Julia macros (due to Julia's @macro syntax). Thanks!

ihnorton commented 11 years ago

+1 to close. Can't replicate either.

pao commented 11 years ago

Going to go ahead and close this. @railskipl, if you can reproduce on an up-to-date build of Julia, please open a new issue for it.