Sarcasm / flycheck-irony

C, C++ and Objective-C support for Flycheck, using Irony Mode
56 stars 10 forks source link

Flycheck does not update errors unless it is reloaded #3

Closed jeremysalwen closed 7 years ago

jeremysalwen commented 9 years ago

I have installed irony, company-irony, yasnippet, and flycheck-irony.

When I first open a file, flycheck works properly, and wil display the error messages from irony. However, if I modify the file, it usually will fail to update the errors. If I run "flycheck-mode" twice, then it will update the errors. The little "FlyC" string above the minibuffer displays "FlyC*" instead of the number of errors/warning, as it does when I first load, and this will never update. I'm new to emacs/irony/flycheck, so I'm not sure if I'm doing something wrong, but it seems like there is a bug, as even when I run "flycheck-buffer" manually, it does not update anything.

Sarcasm commented 9 years ago

This bug has already been reported here https://github.com/Sarcasm/irony-mode/issues/159

This is kind of a design issue in irony-server which I'm struggling finding a proper solution (mostly by lack of time).

You can check the "workaround" proposed in the issue and see if that works for you. I will update this issue when it's fixed.

jeremysalwen commented 9 years ago

Thank you! the workaround seems to be working for me.

soonhokong commented 9 years ago

I'm still experiencing this problem while I'm using the latest version of irony-mode (20150227.1526) and flycheck-irony (20150308.1230).

The symptom is just like @jeremysalwen described. In the beginning, flycheck-irony is working but after some time, it keeps showing "FlyC*" in the mode-line. To turn off and on flycheck-mode fixes the problem temporarily.

FYI, I'm using OS X 10.10.2 / emacs-24.4 / llvm-3.6.0

Sarcasm commented 9 years ago

I noticed it a few times as well but I haven't identified the pattern for now, I'm reopening.

soonhokong commented 9 years ago

@Sarcasm, thank you for the attention!

Hylen commented 9 years ago

This problem occurs very often for me, and it is quite annoying. After some experimentation I found that the "freezing" occurs when editing and then directly switching buffer. After looking some in the code, I think I found the cause.

/Karl

soonhokong commented 9 years ago

@Hylen, I've tried your patch on my mac, but it doesn't work. It gives me "irony process stopped!" message after flycheck starts. FYI, flycheck still shows FlyC*.

soonhokong commented 9 years ago

This is a general question: how can I get more diagnostic information when it doesn't work?

Sarcasm commented 9 years ago

I've tried your patch on my mac, but it doesn't work. It gives me "irony process stopped!" message after flycheck starts. FYI, flycheck still shows FlyC*.

I didn't get this error when testing. Did you try a clean "reboot" of Emacs? I committed some fix, @Hylen patch + another, can you try to update irony?

This is a general question: how can I get more diagnostic information when it doesn't work?

This is a general question I have no general answer yet, for now debugging is mostly dependent on the issues, if I get a pattern in the user issues I may be able to provide such information but right now it's iterative debugging on the issues.

sunpho84 commented 9 years ago

Hi! I installed Irony mode a few days ago through the package manager, and unfortunately I encounter the same error: for some time flycheck works perfectly, then after a few minutes of editing it enters into this "FlyC*" mode and stops checking syntax. Stopping and restarting the on-the-fly checking make it works again, but every time it is just for a few minutes before it freezes again. I have the impression as well that this might be related to change of buffer/jumping around. I am using a few other packages such as yasnippet and ggtags. Of course I will be happy to give all the details that might be useful

naota commented 8 years ago

Maybe, I found the root cause. Irony failed to setup callback function properly.

36.7 Sending Input to Processes states the following:

It also allows filters, sentinels and timers to run—so take account of that in writing your code.

Take a look at irony--parse-buffer-async.

  1. irony clears the callback by (setq ... irony--parse-buffer-callbacks nil ...)
  2. it sends parse request by (irony--send-parse-request "parse" ...)
  3. it appends new callback by (push callback irony--parse-buffer-callbacks)

It seems correct, but it's not. It's possible to get the parse result without callback set. process-send-string() called by irony--send-parse-request() can invoke timer or filter functions. Thus, the following will happen:

  1. irony clears irony--parse-buffer-callbacks
  2. irony sends the parse request
  3. company timer kicks in and invoke company-irony functions
  4. it sends completion request to irony server
  5. irony server's output is read by the filter function
  6. irony get parse command result, but there's no function to call
  7. it now setup parse request callback, but no hope to get it called
  8. flycheck waits for already finished command. Nothing come ever.

I actually, confirmed this happens by inserting debug print around. Hope this help.

Sarcasm commented 8 years ago

Hello @naota,

I just wanted to give you a heads up, I plan to work on a patch when I have sufficient time to do so, the report is great! It explains the issue really well and should be straightforward to fix if there is no other mishaps.

Thank you for helping :+1:

Sarcasm commented 7 years ago

I was able to reproduce the issue easily by adding an additional (sit-for 1) between the moment we send the request and the moment we set the callback.

https://github.com/Sarcasm/irony-mode/commit/3286b72baf96094e846ef549a737ba6a79f99d15 should fix the issue. I hope this is the last issue with this function...

Thanks @naota for figuring all this out!