emacs-ycmd icon indicating copy to clipboard operation
emacs-ycmd copied to clipboard

Stuck in every 10 minutes

Open windrg opened this issue 8 years ago • 15 comments

Hi, Recently I've found that my Emacs is stuck in every 10 minutes precisely. When it shows this symptom, there were ycmd messages in YCMD that seems to be a sort of keep alive messages.

Can you imagine why ycmd causes Emacs stuck? What could be the solution for this?? Please let me know how to improve this or what I have to do to solve this.

PS. I'm running on Emacs 25.1, Ubuntu 14.04 and here're my config for ycmd.

  (use-package ycmd :ensure t)
  (use-package company-ycmd 
                  :ensure t
                  :config
                  (if (eq (is-this-old) nil)
                      (progn
                          (require 'ycmd-eldoc)
                          (add-hook 'ycmd-mode-hook 'ycmd-eldoc-setup)
                          (setq ycmd-default-tags-file-name "TAGS") ;; TODO what if it is "tags"???
                          (eval-after-load "company-ycmd-autoloads"
                          '(progn (company-ycmd-setup)))

                          (eval-after-load "ycmd"
                          '(progn
                              (set-variable 'ycmd-server-command '("python2"))
                              (add-to-list 'ycmd-server-command (expand-file-name "~/.emacs.d/bin/ycmd/ycmd") t)
                              (set-variable 'ycmd-global-config
                                          (expand-file-name "~/.emacs.d/bin/ycmd/cpp/ycm/.ycm_extra_conf.py"))
                              (set-variable 'ycmd-extra-conf-whitelist '("~/"))
			      (set-variable 'ycmd-extra-conf-handler 'load)
                              ;; (set-variable 'ycmd-tag-files 'auto) ;; this makes too many candidates by tags
                              (add-hook 'c-mode-common-hook
                                          (lambda ()
                                              (if (eq global-ycmd-mode nil)
                                                  (ycmd-mode))
                                              (if (eq global-company-mode nil)
                                                  (company-mode))
                                          )
                              )
                                  ))
                          )
                  )
  )

windrg avatar Nov 11 '16 07:11 windrg

Hi,

Thanks for the report.

Could you try to modify this line: https://github.com/abingham/emacs-ycmd/blob/master/ycmd.el#L910 and set sync to nil

ptrv avatar Nov 11 '16 07:11 ptrv

@windrg Did you try the change from my previous post?

ptrv avatar Nov 12 '16 11:11 ptrv

Yes, I did. But it shows the same symptom still. Here're the output when it is set to nil.

2016-11-12 13:55:59,758 - DEBUG - Global extra conf not loaded or no function YcmCorePreload
serving on http://127.0.0.1:47973
2016-11-12 14:05:59,792 - DEBUG - Keeping subservers alive
2016-11-12 14:15:59,889 - DEBUG - Keeping subservers alive
2016-11-12 14:25:59,989 - DEBUG - Keeping subservers alive
2016-11-12 14:36:00,059 - DEBUG - Keeping subservers alive
2016-11-12 14:46:00,075 - DEBUG - Keeping subservers alive
2016-11-12 14:56:00,172 - DEBUG - Keeping subservers alive
2016-11-12 15:06:00,242 - DEBUG - Keeping subservers alive
2016-11-12 15:16:00,330 - DEBUG - Keeping subservers alive
2016-11-12 15:26:00,370 - DEBUG - Keeping subservers alive
2016-11-12 15:36:00,454 - DEBUG - Keeping subservers alive
2016-11-12 15:46:00,525 - DEBUG - Keeping subservers alive
2016-11-12 15:56:00,608 - DEBUG - Keeping subservers alive
2016-11-12 16:06:00,708 - DEBUG - Keeping subservers alive
2016-11-12 16:16:00,769 - DEBUG - Keeping subservers alive
2016-11-12 16:26:00,870 - DEBUG - Keeping subservers alive
2016-11-12 16:36:00,902 - DEBUG - Keeping subservers alive
2016-11-12 16:46:00,979 - DEBUG - Keeping subservers alive
2016-11-12 16:56:00,878 - INFO - Shutting down server due to inactivity
2016-11-12 16:56:00,983 - DEBUG - Global extra conf not loaded or no function VimClose
2016-11-12 16:56:00,986 - DEBUG - Global extra conf not loaded or no function Shutdow

REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/healthy.
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/event_notification. [2 times]
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/completions.
Reverting buffer ‘scsc’.
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/event_notification.
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/completions.
Auto-saving...
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/healthy. [2 times]
Quit
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/event_notification.
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/completions. [2 times]
deferred error : (wrong-type-argument number-or-marker-p nil)
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/completions. [2 times]
Mark set [2 times]
Auto-saving...done
Saving file /home/cysh/.emacs.d/ycmderr.txt...
Wrote /home/cysh/.emacs.d/ycmderr.txt
etu/update-tags-for-file: Args out of range: "/home/cysh/.emacs.d/ycmderr.txt", 55, nil
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/healthy.
REQUEST [error] Error (error) while connecting to http://127.0.0.1:47973/completions.
Mark set
Quit
Text is read-only

windrg avatar Nov 13 '16 06:11 windrg

@ptrv Are we just not recovering from a server shutdown properly?

abingham avatar Nov 13 '16 12:11 abingham

@abingham I am not sure what's going on here. In the latest version of emacs-ycmd we do not send requests at all when the server is not running. I tried to simulate a server shutdown due to inactivity by setting the timeouts accordingly. For me after a shutdown I everything is fine (except requests are not sent anymore because the server is not up, but this is by intention)

Also the server log indicates that there is no keepalive call to the server at all (no line saying INFO - Received health request)

@windrg Are you using the latest emacs-ycmd version?

@abingham I think we need some sort of ycmd-version function that can be called to verify the used emacs-version We get a lot of reports with outdated emacs-ycmd packages.

ptrv avatar Nov 13 '16 13:11 ptrv

@ptrv Here are what I'm using, based on ELPA.

company-ycmd-20161026.2337 flycheck-ycmd-20160913.130 ycmd-20161114.20

Using these w/ the temporal fix you told, it doesn't seem to occur again. Well, however I'm not so sure as I couldn't have enough time to do tests on that. Let me have some more time on it. Thanks.

PS : On the canonical version on elpa, it occurs absolutely

windrg avatar Nov 17 '16 12:11 windrg

Here are what I'm using, based on ELPA.

You mean MELPA (https://melpa.org)? The emacs-ycmd package is not in Gnu Elpa.

Can you post the the output of M-x ycmd-version RET?

PS : On the canonical version on elpa, it occurs absolutely

What do you mean with canonical version?

ptrv avatar Nov 17 '16 18:11 ptrv

@ptrv, here it is.

emacs-ycmd version: 0.9.2snapshot (package: 20161114.20)

windrg avatar Nov 18 '16 08:11 windrg

@windrg Ok, you're on the latest version. And the issue still exists?

ptrv avatar Nov 18 '16 08:11 ptrv

@ptrv, I need more time to do tests. I will give you a feedback soon.

windrg avatar Nov 18 '16 08:11 windrg

Ok, no problem.

Anyways, the temporary fix I suggested in the beginning of this thread is already included in the latest version.

ptrv avatar Nov 18 '16 08:11 ptrv

it happens again on the version 0.9.2 still.

windrg avatar Nov 21 '16 11:11 windrg

We need a clear reproduction for this since I cannot reproduce it.

Can it be that ycmd server is idle for a long time and shuts down? The shutdown is a blocking call. So that might block your Emacs?

ptrv avatar Nov 21 '16 12:11 ptrv

@ptrv, well. Is there any way to get those logs??

windrg avatar Nov 21 '16 12:11 windrg

Can you just save the content of the *ycmd-server* buffer? Or what logs do you mean?

ptrv avatar Nov 21 '16 12:11 ptrv