This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226012 - [74cat] AssertionError: no object for UID KeyBasedUID on FileKey (D:/PROJECTS/Identification/Application/N/, D:\PROJECTS\Identification\Application\IdEmulation\src\ExpressionParser.cpp) in object class org.ne
Summary: [74cat] AssertionError: no object for UID KeyBasedUID on FileKey (D:/PROJECTS...
Status: CLOSED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
: 241820 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-12 10:29 UTC by kosmonaffft
Modified: 2017-05-17 14:05 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 198528


Attachments
stacktrace (2.39 KB, text/plain)
2013-02-12 10:29 UTC, kosmonaffft
Details
fix (12.06 KB, patch)
2015-11-11 14:53 UTC, Vladimir Voskresensky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kosmonaffft 2013-02-12 10:29:28 UTC
Build: NetBeans IDE Dev (Build 201302102300)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.7-b01, Java(TM) SE Runtime Environment, 1.7.0_13-b20
OS: Windows 8

User Comments:
kosmonaFFFt: Just call "code assistance -> reparse project" (via RDP)




Stacktrace: 
java.lang.AssertionError: no object for UID KeyBasedUID on FileKey (D:/PROJECTS/Identification/Application/N/, D:\PROJECTS\Identification\Application\IdEmulation\src\ExpressionParser.cpp) in object class org.netbeans.modules.cnd.modelimpl.csm.deep.LazyCompoundStatementImpl:[6085-6935]
   at org.netbeans.modules.cnd.modelimpl.csm.core.OffsetableBase._getFile(OffsetableBase.java:174)
   at org.netbeans.modules.cnd.modelimpl.csm.core.OffsetableBase.getContainingFile(OffsetableBase.java:144)
   at org.netbeans.modules.cnd.modelimpl.csm.deep.LazyCompoundStatementImpl.resolveLazyStatement(LazyCompoundStatementImpl.java:79)
   at org.netbeans.modules.cnd.modelimpl.csm.deep.LazyStatementImpl.renderStatements(LazyStatementImpl.java:134)
   at org.netbeans.modules.cnd.modelimpl.csm.deep.LazyStatementImpl.createStatements(LazyStatementImpl.java:113)
   at org.netbeans.modules.cnd.modelimpl.csm.deep.LazyStatementImpl.getStatements(LazyStatementImpl.java:85)
Comment 1 kosmonaffft 2013-02-12 10:29:29 UTC
Created attachment 131282 [details]
stacktrace
Comment 2 Maria Tishkova 2014-02-17 14:09:02 UTC
*** Bug 241820 has been marked as a duplicate of this bug. ***
Comment 3 Alexander Simon 2014-08-18 09:27:16 UTC
Code model cache was reworked in Netbeans 8.0.
Comment 4 Alexander Simon 2015-11-11 09:20:19 UTC
see steps to reproduce in the exception report 800811
Comment 5 Vladimir Voskresensky 2015-11-11 14:18:22 UTC
Thanks for reproducible test case.
Comment 6 Vladimir Voskresensky 2015-11-11 14:48:46 UTC
To reproduce the issue close Navigator and use the following c++11 code:
namespace NS {
inline namespace {
void foo() {
  return boo1;
}
}
}


put cursor on foo, wait mark occurrences.
move caret after boo1|

set breakpoint in NamespaceDefinitionImpl.getScopeElements at 
"if (isOfMyScope(decl)) {"
set breakpoint in ProjectBase.setDisposed at "disposing.set(true);"
remove symbol "1", wait 1st breakpoint hit when decl is FunctionDDImpl for "foo"
invoke CA->Reparse project wait 2nd hit

step into 1st till NamespaceImpl.isNamespaceScope before "func.getContainingFile()"
check that func.isValid returns true

do one step for 2nd breakpoint and check that on the 1st now
func.isValid returns false.
Now set break in FileImpl constructor and resume 2nd till FileImpl constructor is hit

try step over in 1st and get NPE.

The reason is:
- getContainingFile in Offsetable base use fileRef (initialized in onDispose) and when null, then calls "file = UIDCsmConverter.UIDtoFile(fileUID);"
but repository is cleaned when Reparse is invoked and no FileImpl can be returned by fileUID
- onDispose was not invoked, because we don't deserialize all model when user invoke Reparse.
Comment 7 Vladimir Voskresensky 2015-11-11 14:53:12 UTC
Created attachment 157274 [details]
fix
Comment 8 Vladimir Voskresensky 2015-11-17 14:49:04 UTC
pushed to enum
changeset: 304275:4a1a44684442 [release81]
Comment 9 Quality Engineering 2015-11-24 02:31:27 UTC
Integrated into 'main-silver', will be available in build *201511240002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0d22bf0a9fed
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #226012 - [74cat] AssertionError: no object for UID KeyBasedUID on FileKey
- always use reference to FileImpl, because it holds reference to "disposed" AtomicBoolean from Project. This is the only way to know that project was requested for Reparse and all live objects became invalid. We want to protect slow clients from returning null from getContainingFile, so hold file
(transplanted from 4a1a44684442e4b98f7d4a1101de43e0ee114c1c)
Comment 10 Alexander Pepin 2015-12-23 14:50:29 UTC
Cannot reproduce the bug in build 20121215.