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 255258 - [newcodemodel] AssertionError: no object for UID null in object class org.netbeans.modules.cnd.modelimpl.csm.MacroImpl:[ offset=79828 - offset=79887 ]
Summary: [newcodemodel] AssertionError: no object for UID null in object class org.net...
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.1
Hardware: All All
: P1 normal (vote)
Assignee: Alexander Simon
URL:
Keywords: 81_HR_FIX
Depends on:
Blocks:
 
Reported: 2015-09-13 19:59 UTC by Exceptions Reporter
Modified: 2015-10-26 15:44 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 219893


Attachments
stacktrace (4.07 KB, text/plain)
2015-09-13 19:59 UTC, Exceptions Reporter
Details
stacktrace (4.07 KB, text/plain)
2015-09-19 13:56 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Exceptions Reporter 2015-09-13 19:59:00 UTC
This issue was reported manually by alexvsimon.
It already has 2 duplicates 


Build: NetBeans IDE Dev (Build 201509050002)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.60-b23, Java(TM) SE Runtime Environment, 1.8.0_60-b27
OS: Mac OS X

User Comments:
GUEST: Opening several files in a row (without saving) to just delete one line in all files

GUEST: Good news. This is a repeatable problem.

Just open around 10 or more C/C++ files (or header files) in a row and the problem occurs.




Stacktrace: 
java.lang.AssertionError: no object for UID null in object class org.netbeans.modules.cnd.modelimpl.csm.MacroImpl:[ offset=79828 - offset=79887 ]
   at org.netbeans.modules.cnd.modelimpl.csm.core.OffsetableBase._getFile(OffsetableBase.java:179)
   at org.netbeans.modules.cnd.modelimpl.csm.core.OffsetableBase.getContainingFile(OffsetableBase.java:144)
   at org.netbeans.modules.cnd.modelimpl.repository.OffsetableKey.<init>(OffsetableKey.java:68)
   at org.netbeans.modules.cnd.modelimpl.repository.MacroKey.<init>(MacroKey.java:65)
   at org.netbeans.modules.cnd.modelimpl.repository.KeyUtilities.createMacroKey(KeyUtilities.java:146)
   at org.netbeans.modules.cnd.modelimpl.uid.UIDUtilities$MacroUID.<init>(UIDUtilities.java:687)
Comment 1 Exceptions Reporter 2015-09-13 19:59:01 UTC
Created attachment 156139 [details]
stacktrace
Comment 2 MackSix 2015-09-19 13:56:59 UTC
Created attachment 156301 [details]
stacktrace

Added a newer MingGW toolchain in Tools->Options->C/C++ and then opened up properties for an exsisting C Project and this was thrown.
Comment 3 Vladimir Kvashin 2015-09-23 21:09:40 UTC
3 duplicates... should it be upgraded?

All dups concern semantic HL
Comment 4 Vladimir Kvashin 2015-09-24 16:41:49 UTC
Has 3 duplicates.
I guess is caused by 
java.lang.Exception: Invalid file in the directive: [2521-2538] annotation=null C:\Developer\mingw64\x86_64-w64-mingw32\include\GL\gl.h #define GL_TRUE
	at org.netbeans.modules.cnd.utils.CndUtils.severe(CndUtils.java:206)
	at org.netbeans.modules.cnd.utils.CndUtils.assertTrue(CndUtils.java:191)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.MacroReference.createMacroReference(MacroReference.java:101)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankMacroUsagesSupport.addMacroExpansions(ClankMacroUsagesSupport.java:94)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankMacroUsagesSupport.getMacroUsages(ClankMacroUsagesSupport.java:69)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankTokenStreamProducer.getMacroUsages(ClankTokenStreamProducer.java:200)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankTokenStreamProducer.getMacroUsages(ClankTokenStreamProducer.java:112)
	at org.netbeans.modules.cnd.modelimpl.parser.clank.ClankFileInfoQuerySupport.getMacroUsages(ClankFileInfoQuerySupport.java:82)
	at org.netbeans.modules.cnd.modelimpl.impl.services.FileInfoQueryImpl.getMacroUsages(FileInfoQueryImpl.java:331)
	at org.netbeans.modules.cnd.highlight.semantic.ModelUtils.getMacroBlocks(ModelUtils.java:120)
	at org.netbeans.modules.cnd.highlight.semantic.SemanticEntitiesProvider$MacrosCodeProvider.getBlocks(SemanticEntitiesProvider.java:354)
	at org.netbeans.modules.cnd.highlight.semantic.SemanticHighlighter.updateImpl(SemanticHighlighter.java:205)
	at org.netbeans.modules.cnd.highlight.semantic.SemanticHighlighter.access$500(SemanticHighlighter.java:91)
	at org.netbeans.modules.cnd.highlight.semantic.SemanticHighlighter$TaskContext.run(SemanticHighlighter.java:433)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)
Comment 5 DimaZh 2015-09-30 14:49:34 UTC
A show-stopper.
Upgraded to P1.
Comment 6 Alexander Simon 2015-09-30 16:56:24 UTC
I see 3 reports.

Reports 793329 & 793333 were fixed long ago (message log show that preprocessor uses freed memory).

The report 794344 partly was fixed in the bug #255419.
Comment 7 Alexander Simon 2015-09-30 17:01:16 UTC
Avoid NPE after assert:
http://hg.netbeans.org/cnd-main/rev/4a5cb085b264
Comment 8 Jiri Kovalsky 2015-09-30 17:50:51 UTC
Mark, are you able to reproduce this exception? If so, your help will be essential for getting this fix propagated to release81 branch. Thanks!
Comment 9 MackSix 2015-10-01 05:27:22 UTC
(In reply to Jiri Kovalsky from comment #8)
> Mark, are you able to reproduce this exception? If so, your help will be
> essential for getting this fix propagated to release81 branch. Thanks!

I only saw it happen this one time, since then it has never happen. I have had no problems since this report setting up and building a freeglut project. 

This is what I did:

http://www.areaofthoughts.com/2015/09/how-to-set-up-freeglut-on-netbeans-ide.html
Comment 10 Jiri Kovalsky 2015-10-01 06:27:45 UTC
Alexander, do you have any hint how to reproduce the bug?

If not, can you Mark try to reproduce the very same scenario in TODAY's build CONTAINING the fix say 10 times and then add your comment here?

This way we will at least gain some confidence that it didn't cause any regressions. Then you can Alexander integrate the patch to release81 branch since according to High Resistance [1] process any 81_HR_FIX bug must be verified prior to its fix is integrated into releases repository.

[1] http://wiki.netbeans.org/NetBeans_81_HighResistance
Comment 11 Alexander Simon 2015-10-01 07:19:13 UTC
(In reply to Jiri Kovalsky from comment #10)
> Alexander, do you have any hint how to reproduce the bug?
Hi Jiri,

The bug has two root cases.
1. A file parsing can be finished while file destroying or project closing/destroying or IDE shutdown. As result a post parsing processing cannot find target file of macro reference. It is a normal work-flow and it should be fixed by last my commit.
2. The post parsing processing receives an invalid macros definition. Macros definition is a result of working clang-based library. The library is changed (and will be changed) constantly while fixing the bug #255362. The assertion in post parsing processing is a reflection of wrong library results. In release mode (-da) assertion will be printed in console only. Any test cases can help fix bugs in the library. At the moment there is no test cases that results in a corrupted macros definition.

To be sure that first case was fixed try to:
- reopen IDE with opened in editor files
- close project/ while parsing and reopen project
- close IDE while parsing and restart IDE again
- remove file while parsing

I see only one way to verify second case:
- create/open a lot of different real projects.

By the way the target milestone "Dev" is not available in the combo box.

Alexander
Comment 12 Jiri Kovalsky 2015-10-01 13:15:41 UTC
Can Valeriy Soldatov please verify the fix in trunk and comment here? As you might know we are in High Resistance [1] mode already. I have created "Dev" target milestone so I am changing it now.

[1] http://wiki.netbeans.org/NetBeans_81_HighResistance
Comment 13 soldatov 2015-10-01 14:52:42 UTC
I tried to reproduce exception in latest build. And I don't see assertion (I used scenarios from Comment 11). I think fix can be integrated into release81.
Comment 14 Jiri Kovalsky 2015-10-01 14:57:49 UTC
OK then. Please integrate the fix to release81 branch.
Comment 15 MackSix 2015-10-01 15:19:52 UTC
(In reply to Jiri Kovalsky from comment #14)
> OK then. Please integrate the fix to release81 branch.

I got a bunch of these exceptions:

http://statistics.netbeans.org/analytics/detail.do?id=220191
Comment 16 Jiri Kovalsky 2015-10-01 15:24:06 UTC
Yes, that's another problem tracked as #255560.
Comment 17 Quality Engineering 2015-10-02 01:37:28 UTC
Integrated into 'main-silver', will be available in build *201510020002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4a5cb085b264
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #255258 [newcodemodel] AssertionError: no object for UID null in object class org.netbeans.modules.cnd.modelimpl.csm.MacroImpl:[ offset=79828 - offset=79887 ]
Comment 18 Alexander Simon 2015-10-05 11:55:32 UTC
Vladimir K.,
please, review the fix.
Comment 19 Vladimir Kvashin 2015-10-05 14:56:26 UTC
(In reply to Alexander Simon from comment #18)
Alexander, I reviewed the fix. I think it is correct and safe.
Comment 20 Alexander Simon 2015-10-06 07:11:51 UTC
fixed in release81:
4a5cb085b264 transplanted to e06320df323b
Comment 21 soldatov 2015-10-26 15:44:12 UTC
Verified in NetBeans IDE 8.1 (Build 201510222201)
In FCS I don't see so much exceptions. And I can't reproduce this exception too. I will mark bug as a VERIFIED.