Review Request 128762: qmljs: restructure duchain locking to prevent deadlocks

Sven Brauch mail at
Thu Sep 1 20:22:36 UTC 2016

This is an automatically generated e-mail. To reply, visit:

(Updated Sept. 1, 2016, 8:22 p.m.)

Review request for KDevelop and Kevin Funk.


Yeah, good that you noticed. I fixed those failures. There might well be others but really, it can't get much worse than now. On a machine with 8 threads, when opening a project with c++ and js code, I reproducably get freezes on initial parsing (try for example).

This has always been wrong, but I think it gets really prominent by clang acquiring the duchain lock without timeout in the foreground all the time (which I still don't think is a very good plan).

Bugs: 367825

Repository: kdevelop


We _must not_ hold a duchain lock when contextOfFile() is called. That
might try to add something to the background parser queue, which locks
the background parser mutex; then both locks are held, which causes

Diffs (updated)

  languages/qmljs/codecompletion/context.cpp 3a44f45 
  languages/qmljs/codecompletion/tests/test_qmljscompletion.cpp b689418 
  languages/qmljs/duchain/declarationbuilder.cpp fb0cb5d 
  languages/qmljs/duchain/expressionvisitor.cpp 3b641f5 
  languages/qmljs/duchain/frameworks/nodejs.cpp 41964e4 
  languages/qmljs/duchain/helper.cpp e537103 
  languages/qmljs/duchain/parsesession.cpp d1ad4a9 



Opened some test project, no crashes, no freezes, and the (I think) reason for the freeze is gone.


Sven Brauch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the KDevelop-devel mailing list