Re: KDevelop can't load project: "too large document"?

Matthew Woehlke <[email protected]>
Newsgroups gmane.comp.kde.users.kdevelop
Message-ID <[email protected]>
On 2017-12-05 16:31, René J.V. Bertin wrote:
> On Tuesday December 05 2017 15:33:42 Matthew Woehlke wrote:
>> I did notice that the backtraces are a significant part of the JSON...
>> does KDevelop need those, and if not, is there a way to omit or strip them?
> 
> No idea.

After looking at the CMake source code: not AFAICT :'(.

I don't know (didn't look) if KDevelop is interested in them; I believe
they are new in 3.10...

> I'd suggest to take a good look where that too-large error message
> really came from.

It comes from cmakeserver.cpp:150:

    auto doc = QJsonDocument::fromJson(data, &error);
    if (error.error) {
        qCWarning(CMAKE) << "error processing" << error.errorString()
                         << data;
    }

Basically, QJson took one look at the size of the data and punted. In
particular, see also https://bugreports.qt.io/browse/QTBUG-58652.

> it seems reasonable that there's an upper limit, and that KDevelop
> would need to detect when this limit is reached and handle that
> situation gracefully

Indeed. At the very least, it shouldn't just quit trying to import the
project, leaving KDevelop in a weird state :-).

>>   $ ll -h compile_commands.json
>>   -rw-rw-r--. 1 matthew matthew 817K Dec  5 15:00 compile_commands.json
> 
> Compared to 100Mb ... that's a sizeable difference!

Yup.

The culprit is
https://gitlab.kitware.com/cmake/cmake/merge_requests/992. That
increased the size of the JSON by about 20x. The *pretty*-printed JSON,
if I strip out the stuff that cmake!992 added, is only about 5 MiB.
(Which is still lots more than the compile commands, but I suspect the
code model dump, even without the traces, has more and better structured
information.)

-- 
Matthew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.