google / zoekt

Fast trigram based code search
1.69k stars 113 forks source link

zoekt-indexserver: Detect Crashing ctags #90

Closed dharesign closed 3 years ago

dharesign commented 5 years ago

I was trying to index a large repository (chromium fork), and a custom built ctags-universal from their master branch was crashing. zoekt-git-index was not detecting the crashed process, and ctags sat there being <defunct>. zoekt-git-index then just sat there until it eventually ran out of memory, and everything started over from the beginning again.

It would be good to have zoekt-git-index and zoekt-indexserver recover when ctags crashes.

hanwen commented 5 years ago

do you have the commit SHA1s for

so I can repro this?

(I fixed a similar issue at https://github.com/google/zoekt/commit/dd7d98162b17e6b91cdd2405b7b5488b1f31fe76 )

dharesign commented 5 years ago

universal-ctags is 92b2f21a575d64a85dcdadbdaacdca06cc29908d

If go get for zoekt fetches the latest master, then I at the current tip of zoekt.

For chromium it's a bit harder, as I don't think we have the exact sha available yet in our public version, but you could try indexing the current tip of https://github.com/bloomberg/chromium.bb and seeing whether that caused any issues.

The particular crash I was getting in ctags was that getEntryInCorkQueue was returning a nullptr here. I built with the following change locally and I managed to get indexing to complete:

diff --git a/parsers/moose.c b/parsers/moose.c
index 4f67404..eed35b1 100644
--- a/parsers/moose.c
+++ b/parsers/moose.c
@@ -213,8 +213,9 @@ static void leaveMoose (struct mooseSubparser *moose)
        moose->notContinuousExtendsLines = true;

        tagEntryInfo *e = getEntryInCorkQueue (moose->classCork);
-       Assert (e);
-       e->extensionFields.endLine = getInputLineNumber ();
+       if (e) {
+               e->extensionFields.endLine = getInputLineNumber ();
+       }

        moose->classCork = CORK_NIL;
        moose->notInMoose = true;
hanwen commented 5 years ago

I think this parser runs on .pl files. Maybe you can dig out which file is the offending one ?

hanwen commented 5 years ago

chromium.bb/src/third_party/perl/perl/vendor/lib/Parse/Method/Signatures.pm

hanwen commented 5 years ago

https://github.com/universal-ctags/ctags/issues/2160

hanwen commented 5 years ago

I haven't been able to repro the hang.