Sourcetrail icon indicating copy to clipboard operation
Sourcetrail copied to clipboard

Sporadic error (translation unit threw an exception): how to pinpoint it?

Open assarbad opened this issue 5 years ago • 5 comments

I am seeing the following error:

FATAL The translation unit threw an exception during indexing. [...]

sourcetrail-error

The thing is, the translation units are fine. In this case it happened for only a single file. But I have seen that for up to 5 out of 45 files by just choosing "Full refresh" (with "All files").

If I simply choose "Full refresh" with "Incomplete & updated files" seconds after the above failure and without any change to the previously failed files, it goes through.

In short: I sometimes see this error, but I cannot reliably reproduce it and it's definitely not caused by a faulty translation unit.

How to proceed? Can someone help me with advice on how to pinpoint the issue?

Thanks,

Oliver

PS: the translation units are all UTF-8 without BOM. This also holds true for most of the include files (certainly for the local ones).

assarbad avatar May 13 '20 12:05 assarbad

Okay, I made a fascinating discovery when looking at the log files (attached logfile.txt) ...

These are three runs, two with failing (1 and 5 failures respectively) and the last one with successful indexing.

Now, if you look at the line below the one starting with 14:34:20 | 15064 | you'll see:

p"

similarly when looking at the (first) line starting with 14:37:22 | 2808 | main.cpp you'll see:

nt: '-wd4324'

These appear exactly that way in the log file.

Doesn't that indicate some sort of synchronization issue at the very least?

Sourcetrail version in use is 2020.1.117 on Windows 10.

NB: log file was redacted (names of the .cpp files, some paths, pruned all but one successful run).

assarbad avatar May 13 '20 13:05 assarbad

I think all indexer processes just write to the same log file, which can lead to strings being split in some cases. Do you think that's an issue?

You can disable File and Console Logging in the preferences. Is this issue gone then?

Otherwise I suggest you disable Multiprocess C/C++ Indexing in the preferences. Then Sourcetrail will just crash whenever a translation unit fails, but you might be able to get more information (best if you use a Debug build)

egraether avatar May 13 '20 14:05 egraether

I think we may have had issues like this when Sourcetrail was unable to open the sqlite database for storing the data from indexing. I extended the logging for this case in 8a75946c.

mlangkabel avatar May 15 '20 10:05 mlangkabel

I filled a similar bug before, #1075, which is closed now; but this bug still happens to me! What's strange is that after the update, it now happens on different files! 🤷🏼‍♂️ Since then, I've switched to compile_commands.json to make sure that I'm configuring everything correctly, but I still get a similar error.

amirmasoudabdol avatar Jan 22 '21 14:01 amirmasoudabdol

The latest beta solves this issue, at least in my case! :-)

amirmasoudabdol avatar Mar 17 '21 08:03 amirmasoudabdol