Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim hangs while exiting a large tags file #519

Closed
naseer opened this issue Aug 19, 2013 · 9 comments
Closed

vim hangs while exiting a large tags file #519

naseer opened this issue Aug 19, 2013 · 9 comments

Comments

@naseer
Copy link

naseer commented Aug 19, 2013

  • Open a large file (In this case it was a tags file of size 34 MB)
  • Quit immediately
  • vim hangs (gdb backtrace below)
Thread 1

#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f99739d74db in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#2  0x00007f9973a8270c in boost::thread::join_noexcept() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#3  0x00007f99739ed89b in YouCompleteMe::IdentifierCompleter::~IdentifierCompleter() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#4  0x00007f9973a1ee5f in boost::python::objects::value_holder<YouCompleteMe::IdentifierCompleter>::~value_holder() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#5  0x00007f9973a4acee in instance_dealloc () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#6  0x00007f9979f96336 in ?? () from /usr/lib/libpython2.7.so.1.0
#7  0x00007f9979fc883f in ?? () from /usr/lib/libpython2.7.so.1.0
#8  0x00007f9979f96384 in ?? () from /usr/lib/libpython2.7.so.1.0
#9  0x00007f9979fc883f in ?? () from /usr/lib/libpython2.7.so.1.0
#10 0x00007f9979f96384 in ?? () from /usr/lib/libpython2.7.so.1.0
#11 0x00007f9979fc883f in ?? () from /usr/lib/libpython2.7.so.1.0
#12 0x00007f9979f96384 in ?? () from /usr/lib/libpython2.7.so.1.0
#13 0x00007f9979f54d37 in ?? () from /usr/lib/libpython2.7.so.1.0
#14 0x00007f9979fd099e in PyDict_SetItem () from /usr/lib/libpython2.7.so.1.0
#15 0x00007f9979fa2290 in _PyModule_Clear () from /usr/lib/libpython2.7.so.1.0
#16 0x00007f9979fa271b in PyImport_Cleanup () from /usr/lib/libpython2.7.so.1.0
#17 0x00007f9979f1dfdb in Py_Finalize () from /usr/lib/libpython2.7.so.1.0
#18 0x00000000005cd67a in python_end () at if_python.c:874
#19 0x00000000005d9e2b in getout (exitval=0) at main.c:1482
#20 0x000000000048ab43 in ex_quit (eap=0x7fff55565090) at ex_docmd.c:6579
#21 0x0000000000493417 in do_one_cmd (cmdlinep=<optimized out>, sourcing=<optimized out>, cstack=<optimized out>, fgetline=0x4a4050 <getexline>, cookie=0x0) at ex_docmd.c:2689
#22 0x0000000000491921 in do_cmdline (cmdline=0x4d910f0 "q", fgetline=0x4a4050 <getexline>, cookie=0x0, flags=<optimized out>) at ex_docmd.c:1127
#23 0x000000000050578e in nv_colon (cap=0x7fff55565830) at normal.c:5457
#24 0x0000000000507ad4 in normal_cmd (oap=0x7fff555658e0, toplevel=1) at normal.c:1200
#25 0x00000000005da3da in main_loop (cmdwin=<optimized out>, noexmode=0) at main.c:1329
#26 0x00000000005dd591 in main (argc=<optimized out>, argv=<optimized out>) at main.c:1020


Thread 2

#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x00007f9979fffc28 in PyThread_acquire_lock () from /usr/lib/libpython2.7.so.1.0
#2  0x00007f9979f1e5f4 in ?? () from /usr/lib/libpython2.7.so.1.0
#3  0x00007f9979f07845 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#4  0x00007f9979ed2605 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#5  0x00007f9979f078c0 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#6  0x00007f9979ed2605 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#7  0x00007f9979f078c0 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#8  0x00007f9979ed2605 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#9  0x00007f9979f078c0 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#10 0x00007f9979ed2605 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#11 0x00007f9979ed28c0 in ?? () from /usr/lib/libpython2.7.so.1.0
#12 0x00007f9979fb6e83 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#13 0x00007f9979f04fca in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#14 0x00007f9979f085eb in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#15 0x00007f9979f085eb in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so.1.0
#16 0x00007f9979ed2605 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so.1.0
#17 0x00007f9979ed27bd in ?? () from /usr/lib/libpython2.7.so.1.0
#18 0x00007f9979fb6e83 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#19 0x00007f9979f9b1cf in ?? () from /usr/lib/libpython2.7.so.1.0
#20 0x00007f9979fb6e83 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#21 0x00007f9979fb77d7 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
#22 0x00007f9979f1d6c2 in ?? () from /usr/lib/libpython2.7.so.1.0
#23 0x00007f997a37ae9a in start_thread (arg=0x7f99708ba700) at pthread_create.c:308
#24 0x00007f99798a4cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#25 0x0000000000000000 in ?? ()

Thread 3

#0  0x00007f99739fc3eb in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_fast_dot_repeat(bool) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
(gdb) bt
#0  0x00007f99739fc3eb in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_fast_dot_repeat(bool) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#1  0x00007f9973a05ab2 in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_all_states() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#2  0x00007f9973a06391 in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find_restart_any() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#3  0x00007f9973a0b14c in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find_imp() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#4  0x00007f9973a0b5f2 in bool boost::regex_search<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char*, std::string>) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#5  0x00007f9973a0bd29 in void boost::algorithm::find_format_all<std::string, boost::algorithm::detail::find_regexF<boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > >, boost::algorithm::detail::empty_formatF<char> >(std::string&, boost::algorithm::detail::find_regexF<boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > >, boost::algorithm::detail::empty_formatF<char>) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#6  0x00007f99739f9f84 in YouCompleteMe::RemoveIdentifierFreeText(std::string) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#7  0x00007f99739ec645 in YouCompleteMe::IdentifierCompleter::AddIdentifiersToDatabaseFromBuffer(std::string const&, std::string const&, std::string const&, bool) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#8  0x00007f99739dd93b in boost::detail::task_object<boost::function<void ()>, void>::do_run() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#9  0x00007f99739ecdd3 in YouCompleteMe::(anonymous namespace)::BufferIdentifiersThreadMain(YouCompleteMe::ConcurrentStack<boost::shared_ptr<boost::packaged_task<void> > >&) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#10 0x00007f9973a81613 in thread_proxy () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#11 0x00007f997a37ae9a in start_thread (arg=0x7f99608ba700) at pthread_create.c:308
#12 0x00007f99798a4cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#13 0x0000000000000000 in ?? ()



@naseer
Copy link
Author

naseer commented Aug 19, 2013

This part is suspicious - this processing should end if vim is closing.

0  0x00007f99739fc3eb in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_fast_dot_repeat(bool) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
(gdb) bt
#0  0x00007f99739fc3eb in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::unwind_fast_dot_repeat(bool) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#1  0x00007f9973a05ab2 in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match_all_states() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#2  0x00007f9973a06391 in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find_restart_any() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#3  0x00007f9973a0b14c in boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find_imp() () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#4  0x00007f9973a0b5f2 in bool boost::regex_search<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char*, std::string>, __gnu_cxx::__normal_iterator<char*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char*, std::string>) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#5  0x00007f9973a0bd29 in void boost::algorithm::find_format_all<std::string, boost::algorithm::detail::find_regexF<boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > >, boost::algorithm::detail::empty_formatF<char> >(std::string&, boost::algorithm::detail::find_regexF<boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > >, boost::algorithm::detail::empty_formatF<char>) ()
   from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so
#6  0x00007f99739f9f84 in YouCompleteMe::RemoveIdentifierFreeText(std::string) () from /usr2/naseer/dotfiles/vim/bundle/YouCompleteMe/autoload/../python/ycm_core.so

@naseer naseer closed this as completed Aug 19, 2013
@naseer naseer reopened this Aug 19, 2013
@Valloric
Copy link
Member

So this is only happening on Vim shutdown? If so, this is a known issue that will be addressed with #358.

@naseer
Copy link
Author

naseer commented Aug 19, 2013

Well, I noticed it only during shutdown.

On Mon, Aug 19, 2013 at 2:21 PM, Val Markovic [email protected]:

So this is only happening on Vim shutdown? If so, this is a known issue
that will be addressed with #358#358
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/519#issuecomment-22892922
.

@Valloric
Copy link
Member

Then it's a known issue. It's caused by YCM background threads still doing work and Vim waiting for them to finish before shutting down. Stopping the threads mid-stream is unsafe (YCM used to do that a long time ago).

@naseer
Copy link
Author

naseer commented Aug 19, 2013

Ok - I think I can live with this for now by disabling YCM for large files.

On Mon, Aug 19, 2013 at 2:27 PM, Val Markovic [email protected]:

Then it's a known issue. It's caused by YCM background threads still doing
work and Vim waiting for them to finish before shutting down. Stopping the
threads mid-stream is unsafe (YCM used to do that a long time ago).


Reply to this email directly or view it on GitHubhttps://github.com//issues/519#issuecomment-22893331
.

@Valloric
Copy link
Member

This is actually a duplicate of #218, which in turn is dependent on #358. Closing.

@norcalli
Copy link

@naseer How exactly did you disable YCM for large files? Disabling YCM on a perfile basis would be useful. I know about the blacklist variable, but that doesn't help with identifying large files.

@naseer
Copy link
Author

naseer commented Oct 16, 2014

@norcalli - at that time I had a check like this for something else - http://vim.wikia.com/wiki/Faster_loading_of_large_files
I simply added the YCM Neobundle include inside that
Later on, I realized only loaded YCM on C++/Python files
Now - It's no longer necessary since #358 and #218 are fixed

@Shougo
Copy link

Shougo commented Oct 16, 2014

I think it is Vim's GC problem.
The patch is exists. But it is not merged now.

https://groups.google.com/forum/#!searchin/vim_dev/GC/vim_dev/DBYOdHQWvqY/1WH04_dwETIJ

bijancn pushed a commit to bijancn/YouCompleteMe that referenced this issue Jul 26, 2016
…lders, r=Valloric

[READY] Use LIBPL variable to find Python library

Currently, the `build.py` script may found a debug version of the Python library instead of the release version because it searches through all the subdirectories of the standard library path. See issue ycm-core#518 for details. The solution suggested by @jmenashe (using `LIBPL` variable) works fine for system Python but not for `pyenv` because there is no dynamic library in the directory returned by the `LIBPL` variable.

Taking this into account, we now search the Python library in a list of directories. On Windows, this list only contains one directory; the same one as before. On other platforms, it contains two directories:
 - the one returned by the `LIBPL` variable (for system Python);
 - the parent directory of the standard Python library modules (for pyenv).

Closes ycm-core#518.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/519)
<!-- Reviewable:end -->
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants