Bug 363180 - The qmljs parser crashes in QmlJS::getDeclaration
Summary: The qmljs parser crashes in QmlJS::getDeclaration
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: QML/JavaScript (show other bugs)
Version: 4.7.3
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-17 13:07 UTC by Jonathan Verner
Modified: 2017-09-15 22:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
first 100 and last 100 frames from backtrace (139.21 KB, text/plain)
2016-05-17 13:08 UTC, Jonathan Verner
Details
File which crashes kdevelop (1.08 KB, application/javascript)
2016-05-17 13:08 UTC, Jonathan Verner
Details
The full node module showing the problem (1.14 MB, application/zip)
2016-05-28 10:14 UTC, Jonathan Verner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Verner 2016-05-17 13:07:29 UTC
When parsing the attached file, kdevelop immediately crashes with the attached backtrace (the backtrace has 65000 frames so I am attaching only the first and last 100 and pasting only the first few here):

#0  0x00007ffff1979a91 in ?? () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#1  0x00007ffff1978af6 in KDevelop::IndexedQualifiedIdentifier::IndexedQualifiedIdentifier() ()
   from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#2  0x00007ffff19c50f8 in KDevelop::PersistentSymbolTable::getDeclarations(KDevelop::IndexedQualifiedIdentifier const&) const () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#3  0x00007ffff19c5f09 in KDevelop::PersistentSymbolTable::getFilteredDeclarations(KDevelop::IndexedQualifiedIdentifier const&, Utils::StorableSet<KDevelop::IndexedTopDUContext, KDevelop::IndexedTopDUContextIndexConversion, KDevelop::RecursiveImportRepository, true, Utils::DummyLocker> const&) const ()
   from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#4  0x00007ffff195704d in ?? () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#5  0x00007ffff19575a8 in bool KDevelop::TopDUContext::applyAliases<KDevelop::TopDUContext::FindDeclarationsAcceptor>(KDevelop::QualifiedIdentifier const&, KSharedPtr<KDevelop::DUContext::SearchItem> const&, KDevelop::TopDUContext::FindDeclarationsAcceptor&, KDevelop::CursorInRevision const&, bool, KDevelop::TopDUContext::ApplyAliasesBuddyInfo*, unsigned int) const () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#6  0x00007ffff19509f4 in KDevelop::TopDUContext::findDeclarationsInternal(KDevVarLengthArray<KSharedPtr<KDevelop::DUContext::SearchItem>, 256> const&, KDevelop::CursorInRevision const&, TypePtr<KDevelop::AbstractType> const&, KDevVarLengthArray<KDevelop::Declaration*, 40>&, KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>, unsigned int) const () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#7  0x00007ffff19433e1 in KDevelop::DUContext::findDeclarations(KDevelop::Identifier const&, KDevelop::CursorInRevision const&, KDevelop::TopDUContext const*, QFlags<KDevelop::DUContext::SearchFlag>) const
    () from /usr/lib/libkdevplatformlanguage.so.8
No symbol table info available.
#8  0x00007fff2ec43eab in QmlJS::getDeclaration (id=..., context=context@entry=0x7fff08106830,
    searchInParent=searchInParent@entry=true)
    at /home/jonathan/zdroj/kde/src/kdev-qmljs/duchain/helper.cpp:57
        declarations = {{p = {static shared_null = {ref = {_q_value = 1}, alloc = 0, begin = 0,
                end = 0, sharable = 1, array = {0x0}}, d = 0x7fff08dbfcc0}, d = 0x7fff08dbfcc0}}
        lock = {m_lock = 0x1517d20, m_locked = true, m_timeout = 0}
#9  0x00007fff2ec44831 in QmlJS::getInternalContext (declaration=...)
    at /home/jonathan/zdroj/kde/src/kdev-qmljs/duchain/helper.cpp:230
        baseClass = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1},
            alloc = 0, size = 0, data = 0x62109a <QString::shared_null+26>, clean = 0, simpletext = 0,
            righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}},
          static shared_empty = {ref = {_q_value = 2446}, alloc = 0, size = 0,
            data = 0x7ffff521191a <QString::shared_empty+26>, clean = 0, simpletext = 0,
            righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}},
          d = 0x7fff08dbfce0, static codecForCStrings = 0x0}
        structureType = <optimized out>
        integralType = <optimized out>
        lock = {m_lock = 0x1517d20, m_locked = true, m_timeout = 0}
        functionType = <optimized out>
#10 0x00007fff2ec44839 in QmlJS::getInternalContext (declaration=...)
    at /home/jonathan/zdroj/kde/src/kdev-qmljs/duchain/helper.cpp:230
        baseClass = {static null = {<No data fields>}, static shared_null = {ref = {_q_value = 1},
            alloc = 0, size = 0, data = 0x62109a <QString::shared_null+26>, clean = 0, simpletext = 0,
            righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}},
          static shared_empty = {ref = {_q_value = 2446}, alloc = 0, size = 0,
            data = 0x7ffff521191a <QString::shared_empty+26>, clean = 0, simpletext = 0,
            righttoleft = 0, asciiCache = 0, capacity = 0, reserved = 0, array = {0}},
          d = 0x7fff08dbfc20, static codecForCStrings = 0x0}
        structureType = <optimized out>
        integralType = <optimized out>
        lock = {m_lock = 0x1517d20, m_locked = true, m_timeout = 0}
        functionType = <optimized out>




Reproducible: Always

Steps to Reproduce:
1. Open the attached file assign.js
Comment 1 Jonathan Verner 2016-05-17 13:08:10 UTC
Created attachment 99032 [details]
first 100 and last 100 frames from backtrace
Comment 2 Jonathan Verner 2016-05-17 13:08:47 UTC
Created attachment 99033 [details]
File which crashes kdevelop
Comment 3 Jonathan Verner 2016-05-17 20:18:19 UTC
Note, I am using kdev-qmls compiled from source from the following commit: 3f9a3d8453ae29cf7fa8a753010806398f08fa0c (should be one bugfix ahead of the v1.2.0/v1.7.0 tags).
Comment 4 Jonathan Verner 2016-05-18 09:36:32 UTC
P.S. As a shortterm workaround Is it possible to tell kdevelop to skip parsing a given file?
Comment 5 Kevin Funk 2016-05-18 09:44:35 UTC
See here: http://comments.gmane.org/gmane.comp.kde.users.kdevelop/7102 -- HTH
Comment 6 Jonathan Verner 2016-05-18 11:17:51 UTC
@Kevin Funk: Thanks very much! I should have googled for this, sorry for wasting your time.
Comment 7 Denis Steckelmacher 2016-05-28 09:15:14 UTC
Could you attach the contents of "./root" as a ZIP? If I open your file, it parses properly but most of its types are unknown because "require('./root')" does not find anything to import.

If ./root is large and/or contains files that you don't want to disclose, you may want to try to build a simplified project with your file and an empty ./root directory, to which you progressively add files until the crash occurs. This takes more time, though.
Comment 8 Jonathan Verner 2016-05-28 10:14:27 UTC
Created attachment 99227 [details]
The full node module showing the problem
Comment 9 Jonathan Verner 2016-05-28 10:15:16 UTC
Note that the problematic file assign.js is in the rxjs/util/ directory.
Comment 10 Denis Steckelmacher 2016-05-28 11:03:08 UTC
I cannot reproduce the crash on KDevelop 5.0 (git version), that contains a KDevelop5-ready version of QML/JS. Your bug seems to have been fixed in the meantime. KDevelop 4 being still maintained (I think), I'll try to reproduce the bug on that version with kdev-qmljs 1.7.0. It may take a couple days, though, as I'm currently trying to fix bugs in the 5.0 version.

If your KDevelop is older than 4.7.3 (released this January, along with kdevplatform 1.7.3), you may try to update it and see if the bug is still present. The crash happens in KDevelop::IndexedQualifiedIdentifier::IndexedQualifiedIdentifier(), quite deep into KDevPlatform code. It may be caused by an improper use of the library by kdev-qmljs, or by a bug that is now fixed.
Comment 11 Jonathan Verner 2016-05-28 16:00:03 UTC
@Denis: No problem, the workaround suggested by Kevin works o.k. for me. Great to hear the bug is fixed in Kdevelop 5. I guess I will eventually be upgrading to KDE 5 anyway.

Btw, kdevelop is the *BEST* IDE I ever used! Thanks for your hard and amazing work.
Comment 12 Kevin Funk 2017-09-15 14:54:43 UTC
@Jonathan: Could you please check whether this is still a problem in newer KDevelop?
Comment 13 Jonathan Verner 2017-09-15 22:27:14 UTC
I can comment that the crash does not appear anymore.
Comment 14 Jonathan Verner 2017-09-15 22:30:05 UTC
"comment"=>"confirm"; its too late for me to be replying :-) Plus I forgot to mention that my version is 5.1.2 With 5.2 (nightly AppImage) it doesn't crash either.