Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 252 forks source link

Indexing appears to be stuck in a never ending state #1171

Open revelationnow opened 6 years ago

revelationnow commented 6 years ago

Please mark appropriate

Problem description

I have a project with around 2300 C/C++ source files, when I run rc -J, I can see rdm starts running and the percentage completion shows up just fine in the beginning, something like: [ 18%] 402/2211 19:57:38 However after a bit, the number of files starts to grow, which I believe is unexpected and the indexing never completes. Some files in my project remain unindexed. [ 19%] 411/2216 19:57:39 [ 28%] 710/2511 19:58:02 [ 37%] 1047/2847 19:58:18 [ 52%] 1957/3756 19:59:46 [ 52%] 1962/3759 19:59:46 [ 55%] 2157/3953 20:00:02 [ 64%] 3240/5035 20:01:49 [ 66%] 3530/5324 20:01:59 [ 67%] 3670/5463 20:02:11 [ 74%] 5001/6793 20:03:38 [ 84%] 9235/11026 20:08:28 [ 87%] 11548/13338 20:11:11

I left it running overnight, and this morning I see: [100%] 779286/781076 11:15:59 [100%] 801808/803598 11:43:22 [100%] 807104/808892 11:49:40

Expected behavior

I was expecting that all the files would be indexed, the compile time for this build is generally around 5 minutes, and expected the indexing to complete in roughly that much time as well, perhaps a little more for rtags specific activities

Actual behavior

It appears to keep indexing infinitely. rc --is-indexing returns 1 even after the [100%] output from rdm. The difference between processed files and total files is always around 1790, as if the 421st file (If actual total is 2211) sent the indexer into some kind of infinite loop.

Environment

Ubuntu 14.04

Custom clang cross-compiler based on 3.9.0

Feature request

Describe the feature we should add to RTags.

revelationnow commented 6 years ago

Debugging a bit more, it appears that the same 8 files are getting marked dirty over and over even though I've not touched those files. Is there a way to disable the indexing of dirty files?

revelationnow commented 6 years ago

I tried disabling reindexing with information from https://github.com/Andersbakken/rtags/issues/688 the issue still persists however, it seems as if a few files keep getting re-added to the jobs list as new files, not sure what might be triggering that.

ajknapp commented 5 years ago

I'm also experiencing a version of this bug. The fix from #688 does not work for me either.

aburdulescu commented 4 years ago

I've had a similar problem and I fixed it by changing the permissions for ~/.cache. Details below:

I installed rtags from source, started rdm then added a project with rc -j /path/to/compile_commands. I ran rc -s jobs to see if rdm was done indexing. The output showed that it had jobs pending and 4 jobs active. I waited some time and ran rc -s jobs again, the output was the same as before. Moreover, the same jobs were active as before.

I had a look at the logs of rdm and there was this log printed multiple times: "Can't save file ids"

rdm tries to write some file ids in a file called fileids located in ~/.cache/rtags/. In my case it could not do this because the directory ~/.cache was owned by root and rdm was run by my user(which wasn't root).

I don't know if you have the same problem but if it is I hope this helps.

revelationnow commented 4 years ago

Thanks for the comment. I've since moved on to using language servers, While they are still relatively nascent, it has been working well so far.