Skip to content

Deadlock in complete_add #2

Closed
ridiculousfish opened this Issue May 11, 2012 · 2 comments

2 participants

@ridiculousfish
The user-friendly shell member

Call graph:
2903 Thread_2498 DispatchQueue_1: com.apple.main-thread (serial)
2903 start (in libdyld.dylib) + 1 [0x7fff8df5d7e1]
2903 main (in fish) + 1299 [0x104812eb3] fish.cpp:324
2903 reader_read(int, io_data_t) (in fish) + 318 [0x1047e774e] reader.cpp:2570
2903 reader_readline() (in fish) + 1879 [0x1047e5287] reader.cpp:2840
2903 complete(std::basic_string, std::allocator > const&, std::vector >&, complete_type_t, std::vector, std::allocator >, std::allocator, std::allocator > > >
) (in fish) + 1914 [0x1047bc7ca] complete.cpp:1880
2903 completer_t::complete_param(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, bool) (in fish) + 2271 [0x1047bb803] complete.cpp:1376
2903 completer_t::complete_from_args(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, int) (in fish) + 135 [0x1047b8547] complete.cpp:1139
2903 parser_t::eval_args(wchar_t const, std::vector >&) (in fish) + 393 [0x1047d9a2b] parser.cpp:802
2903 expand_string(std::basic_string, std::allocator > const&, std::vector >&, int) (in fish) + 674 [0x1047ccba2] expand.cpp:1451
2903 expand_cmdsubst(parser_t&, std::basic_string, std::allocator > const&, std::vector >&) (in fish) + 444 [0x1047c8cec] expand.cpp:1178
2903 exec_subshell_internal(std::basic_string, std::allocator > const&, std::vector, std::allocator >, std::allocator, std::allocator > > >
) (in fish) + 189 [0x1047c54ed] exec.cpp:1401
2903 parser_t::eval(std::basic_string, std::allocator > const&, io_data_t, block_type_t) (in fish) + 496 [0x1047de67c] parser.cpp:2506
2903 parser_t::eval_job(tokenizer
) (in fish) + 1270 [0x1047de262] parser.cpp:2333
2903 exec(parser_t&, job_t) (in fish) + 2480 [0x1047c7190] exec.cpp:830
2903 internal_exec_helper(parser_t&, wchar_t const
, block_type_t, io_data_t) (in fish) + 142 [0x1047c5dae]
2903 parser_t::eval(std::basic_string, std::allocator > const&, io_data_t
, block_type_t) (in fish) + 496 [0x1047de67c] parser.cpp:2506
2903 parser_t::eval_job(tokenizer) (in fish) + 1270 [0x1047de262] parser.cpp:2333
2903 exec(parser_t&, job_t
) (in fish) + 2480 [0x1047c7190] exec.cpp:830
2903 internal_exec_helper(parser_t&, wchar_t const, block_type_t, io_data_t) (in fish) + 142 [0x1047c5dae]
2903 parser_t::eval(std::basic_string, std::allocator > const&, io_data_t, block_type_t) (in fish) + 496 [0x1047de67c] parser.cpp:2506
2903 parser_t::eval_job(tokenizer
) (in fish) + 738 [0x1047de04e] parser.cpp:2300
2903 parser_t::parse_job(process_t, job_t, tokenizer) (in fish) + 4727 [0x1047dcdbb] parser.cpp:2159
2903 parser_t::parse_job_argument_list(process_t
, job_t, tokenizer, std::vector >&) (in fish) + 1200 [0x1047dd5bc] parser.cpp:1398
2903 expand_string(std::basic_string, std::allocator > const&, std::vector >&, int) (in fish) + 674 [0x1047ccba2] expand.cpp:1451
2903 expand_cmdsubst(parser_t&, std::basic_string, std::allocator > const&, std::vector >&) (in fish) + 444 [0x1047c8cec] expand.cpp:1178
2903 exec_subshell_internal(std::basic_string, std::allocator > const&, std::vector, std::allocator >, std::allocator, std::allocator > > >) (in fish) + 189 [0x1047c54ed] exec.cpp:1401
2903 parser_t::eval(std::basic_string, std::allocator > const&, io_data_t
, block_type_t) (in fish) + 496 [0x1047de67c] parser.cpp:2506
2903 parser_t::eval_job(tokenizer) (in fish) + 1235 [0x1047de23f] parser.cpp:2333
2903 exec(parser_t&, job_t
) (in fish) + 3194 [0x1047c745a] exec.cpp:981
2903 builtin_run(parser_t&, wchar_t const* const, io_data_t) (in fish) + 542 [0x1047b4f7e] builtin.cpp:3708
2903 builtin_complete(parser_t&, wchar_t) (in fish) + 2024 [0x1047ac9e8] builtin_complete.cpp:548
2903 complete(std::basic_string, std::allocator > const&, std::vector >&, complete_type_t, std::vector, std::allocator >, std::allocator, std::allocator > > >) (in fish) + 1914 [0x1047bc7ca] complete.cpp:1880
2903 completer_t::complete_param(std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, std::basic_string, std::allocator > const&, bool) (in fish) + 248 [0x1047bb01c] complete.cpp:1237
2903 autoload_t::load(std::basic_string, std::allocator > const&, bool) (in fish) + 462 [0x10480d112] autoload.cpp:107
2903 autoload_t::locate_file_and_maybe_load_it(std::basic_string, std::allocator > const&, bool, bool, std::vector, std::allocator >, std::allocator, std::allocator > > > const&) (in fish) + 1709 [0x10480cccf] autoload.cpp:327
2903 exec_subshell_internal(std::basic_string, std::allocator > const&, std::vector, std::allocator >, std::allocator, std::allocator > > >
) (in fish) + 189 [0x1047c54ed] exec.cpp:1401
2903 parser_t::eval(std::basic_string, std::allocator > const&, io_data_t, block_type_t) (in fish) + 496 [0x1047de67c] parser.cpp:2506
2903 parser_t::eval_job(tokenizer
) (in fish) + 1235 [0x1047de23f] parser.cpp:2333
2903 exec(parser_t&, job_t) (in fish) + 3194 [0x1047c745a] exec.cpp:981
2903 builtin_run(parser_t&, wchar_t const
const, io_data_t) (in fish) + 542 [0x1047b4f7e] builtin.cpp:3708
2903 builtin_complete(parser_t&, wchar_t
) (in fish) + 2726 [0x1047acca6] builtin_complete.cpp:129
2903 builtin_complete_add2(wchar_t const, int, wchar_t const, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&, int, wchar_t const, wchar_t const, wchar_t const, int) (in fish) + 122 [0x1047b46da]
2903 complete_add(wchar_t const
, bool, wchar_t, wchar_t const, int, int, wchar_t const, wchar_t const, wchar_t const, int) (in fish) + 113 [0x1047ba891] complete.cpp:436
2903 scoped_lock::lock() (in fish) + 72 [0x1048033f4] common.cpp:1988
2903 pthread_mutex_lock (in libsystem_c.dylib) + 536 [0x7fff94bfe9c9]
2903 __psynch_mutexwait (in libsystem_kernel.dylib) + 10 [0x7fff90bb2136]

@ridiculousfish
The user-friendly shell member

Fixed as c159751

@niemeyer niemeyer referenced this issue Jun 5, 2012
Closed

Segfault on ~ #34

@funkytaco

FYI the word is 'trailing', not 'trialing' for 'trailing spaces' in your commit notes. ;)

@DarkStarSword DarkStarSword added a commit to DarkStarSword/fish-shell that referenced this issue Sep 10, 2012
@DarkStarSword DarkStarSword Remove wperror causing pthreads weirdness
I'm not entirely sure what is going on, but on one machine I run fish on
a couple of times a day I find an instance of fish using 100% CPU.
Killing it never kills an interactive session, so it is presumably
something fish is doing in the background.

strace shows it repeatedly calling sys_FUTEX with an invalid op (0xef).
Since the op is invalid, the kernel returns -ENOSYS, but pthreads keeps
spinning hoping for success and uses 100% CPU.

The backtraces always look similar to:

> (gdb) bt
> #0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
> #1  0x00007f9739351861 in pthread_rwlock_rdlock ()
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S:120
> #2  0x00007f973884e778 in __dcigettext (domainname=<optimized out>, msgid1=0xef <Address 0xef out of bounds>,
>     msgid2=0x0, plural=-1, n=0, category=<optimized out>) at dcigettext.c:460
> #3  0x00007f97388a0ad8 in *__GI___strerror_r (errnum=5, buf=0x0, buflen=0) at _strerror.c:65
> #4  0x00007f97388a09de in strerror (errnum=951726048) at strerror.c:33
> #5  0x000000000050f15e in wperror(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) ()
> #6  0x00000000004cfd0b in do_builtin_io(char const*, char const*) ()
> #7  0x00000000004d1038 in exec(parser_t&, job_t*) ()
> #8  0x00000000004f1ed8 in parser_t::eval_job(tokenizer*) ()
> #9  0x00000000004f2629 in parser_t::eval(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_
> #10 0x00000000004cfb9c in internal_exec_helper(parser_t&, wchar_t const*, block_type_t, io_chain_t&) ()
> #11 0x00000000004d07bc in exec(parser_t&, job_t*) ()
> #12 0x00000000004f1ed8 in parser_t::eval_job(tokenizer*) ()
> #13 0x00000000004f2629 in parser_t::eval(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, io_
> #14 0x000000000051fac0 in event_fire_internal(event_t const*) ()
> #15 0x00000000005200c7 in event_fire(event_t*) ()
> #16 0x00000000004f8a5e in proc_fire_event(wchar_t const*, int, int, int) ()
> #17 0x000000000053ee7b in main ()

There is some weirdness here - in particular, the errnum passed to
strerror randomises (but is never sensible), the msgid1 is passed as
0xef (i.e. the same as the op passed to sys_FUTEX).

Until I better understand what is going on, remove the wperror call that
is present in every backtrace. I'll keep an eye on things and see if it
happens again.

Signed-off-by: Ian Munsie <darkstarsword@gmail.com>
843a62d
@ridiculousfish ridiculousfish added a commit that referenced this issue Feb 5, 2016
@ridiculousfish ridiculousfish Experiment #2
It's asan's fault!
d8d0548
@ridiculousfish ridiculousfish added a commit that referenced this issue Feb 5, 2016
@ridiculousfish ridiculousfish Experiment #2
It's asan's fault!
3f59b65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.