Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null pointer exception on generate #64

Open
ftomassetti opened this issue May 18, 2020 · 4 comments
Open

Null pointer exception on generate #64

ftomassetti opened this issue May 18, 2020 · 4 comments

Comments

@ftomassetti
Copy link

when running the generate task it fails showing a NPE:

Caused by: java.lang.RuntimeException: java.lang.NullPointerException
Problem disposing mps.NodeUsage
        at com.intellij.util.io.PersistentEnumeratorBase.valueOf(PersistentEnumeratorBase.java:489)
        at com.intellij.util.io.PersistentBTreeEnumerator.valueOf(PersistentBTreeEnumerator.java:505)
com.intellij.testFramework.LoggedErrorProcessor$TestLoggerAssertionError: java.io.IOException: java.lang.RuntimeException: java.lang.NullPointerException
        at com.intellij.testFramework.LoggedErrorProcessor.processError(LoggedErrorProcessor.java:56)
        at com.intellij.util.io.PersistentEnumeratorBase.isKeyAtIndex(PersistentEnumeratorBase.java:410)
        at com.intellij.util.io.PersistentBTreeEnumerator.enumerateImpl(PersistentBTreeEnumerator.java:413)
        at com.intellij.testFramework.TestLogger.error(TestLogger.java:40)
        at com.intellij.util.io.PersistentEnumeratorBase.doEnumerate(PersistentEnumeratorBase.java:294)
        ... 66 more
Caused by: java.lang.NullPointerException
        at com.intellij.openapi.diagnostic.Logger.error(Logger.java:170)
        at jetbrains.mps.util.io.ModelInputStream.readModelID(ModelInputStream.java:187)
        at jetbrains.mps.workbench.findusages.UsageEntry.load(UsageEntry.java:59)
        at com.intellij.util.indexing.impl.MapReduceIndex.dispose(MapReduceIndex.java:186)
        at jetbrains.mps.workbench.findusages.UsageEntryKeyDescriptor.read(UsageEntryKeyDescriptor.java:52)
        at com.intellij.util.indexing.FileBasedIndexImpl.performShutdown(FileBasedIndexImpl.java:531)
        at com.intellij.util.indexing.FileBasedIndexImpl.access$5100(FileBasedIndexImpl.java:107)
        at com.intellij.util.indexing.FileBasedIndexImpl$FileIndexDataInitialization.lambda$prepare$1(FileBasedIndexImpl.java:2469)
        at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:104)
        at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
        at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71)
        at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:92)
        at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
        at jetbrains.mps.workbench.findusages.UsageEntryKeyDescriptor.read(UsageEntryKeyDescriptor.java:33)
        at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71)
        at com.intellij.util.io.AppendableStorageBackedByResizableMappedFile.read(AppendableStorageBackedByResizableMappedFile.java:85)
        at com.intellij.openapi.util.ObjectNode.lambda$execute$0(ObjectNode.java:92)
        at com.intellij.util.io.PersistentEnumeratorBase.valueOf(PersistentEnumeratorBase.java:476)
        at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
        ... 70 more
        at com.intellij.openapi.util.ObjectNode.execute(ObjectNode.java:71)
        at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:133)
        at com.intellij.openapi.util.Disposer.dispose(Disposer.java:123)
        at com.intellij.openapi.util.Disposer.dispose(Disposer.java:119)
        at com.intellij.idea.IdeaTestApplication.disposeInstance(IdeaTestApplication.java:141)
        at com.intellij.idea.IdeaTestApplication.dispose(IdeaTestApplication.java:133)
        at com.intellij.openapi.util.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:183)
        at com.intellij.openapi.util.ObjectTree.executeUnregistered(ObjectTree.java:196)
        at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:127)
        at com.intellij.openapi.util.Disposer.dispose(Disposer.java:123)
        at com.intellij.openapi.util.Disposer.dispose(Disposer.java:119)
        at jetbrains.mps.tool.environment.IdeaEnvironment$2$2.run(IdeaEnvironment.java:262)
        at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:885)
        at jetbrains.mps.tool.environment.IdeaEnvironment$2.run(IdeaEnvironment.java:259)
        at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:309)
        at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:154)
        at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:441)
        at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:424)
        at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:407)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
        at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:908)
        at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:781)
        at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:424)
        at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:698)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:423)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: com.intellij.util.indexing.StorageException: java.io.IOException: java.lang.RuntimeException: java.lang.NullPointerException
        at com.intellij.util.indexing.impl.MapIndexStorage.unwrapCauseAndRethrow(MapIndexStorage.java:284)
        at com.intellij.util.indexing.impl.MapIndexStorage.close(MapIndexStorage.java:184)
        at com.intellij.util.indexing.VfsAwareMapIndexStorage.close(VfsAwareMapIndexStorage.java:119)
        at com.intellij.util.indexing.MemoryIndexStorage.close(MemoryIndexStorage.java:114)
        at com.intellij.util.indexing.impl.MapReduceIndex.doDispose(MapReduceIndex.java:196)
        at com.intellij.util.indexing.VfsAwareMapReduceIndex.doDispose(VfsAwareMapReduceIndex.java:346)
        at com.intellij.util.indexing.impl.MapReduceIndex.dispose(MapReduceIndex.java:183)
        ... 48 more
Caused by: java.io.IOException: java.lang.RuntimeException: java.lang.NullPointerException
        at com.intellij.util.io.PersistentEnumeratorBase.doEnumerate(PersistentEnumeratorBase.java:304)
        at com.intellij.util.io.PersistentEnumeratorBase.enumerate(PersistentEnumeratorBase.java:317)
        at com.intellij.util.io.PersistentEnumeratorDelegate.enumerate(PersistentEnumeratorDelegate.java:98)
        at com.intellij.util.io.PersistentHashMap.enumerate(PersistentHashMap.java:408)
        at com.intellij.util.io.PersistentHashMap.appendDataWithoutCache(PersistentHashMap.java:446)
        at com.intellij.util.io.PersistentHashMap$4.onDropFromCache(PersistentHashMap.java:255)
        at com.intellij.util.io.PersistentHashMap$4.onDropFromCache(PersistentHashMap.java:246)
        at com.intellij.util.containers.SLRUMap.clear(SLRUMap.java:166)
        at com.intellij.util.io.PersistentHashMap.clearAppenderCaches(PersistentHashMap.java:725)
        at com.intellij.util.io.PersistentHashMap.doForce(PersistentHashMap.java:713)
        at com.intellij.util.io.PersistentHashMap.force(PersistentHashMap.java:705)
        at com.intellij.util.indexing.impl.MapIndexStorage.flush(MapIndexStorage.java:166)
        at com.intellij.util.indexing.VfsAwareMapIndexStorage.flush(VfsAwareMapIndexStorage.java:107)
        at com.intellij.util.indexing.impl.MapIndexStorage.close(MapIndexStorage.java:177)
        ... 53 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
        at com.intellij.util.io.PersistentEnumeratorBase.valueOf(PersistentEnumeratorBase.java:489)
        at com.intellij.util.io.PersistentBTreeEnumerator.valueOf(PersistentBTreeEnumerator.java:505)
        at com.intellij.util.io.PersistentEnumeratorBase.isKeyAtIndex(PersistentEnumeratorBase.java:410)
        at com.intellij.util.io.PersistentBTreeEnumerator.enumerateImpl(PersistentBTreeEnumerator.java:413)
        at com.intellij.util.io.PersistentEnumeratorBase.doEnumerate(PersistentEnumeratorBase.java:294)
        ... 66 more
Caused by: java.lang.NullPointerException
        at jetbrains.mps.util.io.ModelInputStream.readModelID(ModelInputStream.java:187)
        at jetbrains.mps.workbench.findusages.UsageEntry.load(UsageEntry.java:59)
        at jetbrains.mps.workbench.findusages.UsageEntryKeyDescriptor.read(UsageEntryKeyDescriptor.java:52)
        at jetbrains.mps.workbench.findusages.UsageEntryKeyDescriptor.read(UsageEntryKeyDescriptor.java:33)
        at com.intellij.util.io.AppendableStorageBackedByResizableMappedFile.read(AppendableStorageBackedByResizableMappedFile.java:85)
        at com.intellij.util.io.PersistentEnumeratorBase.valueOf(PersistentEnumeratorBase.java:476)

I am using MPS 2019.3.1, so I think that the relevant line of ModelInputStream is this: https://github.com/JetBrains/MPS/blob/5ba63e438847f4ec758bf1bf3175eb94de281012/core/kernel/source/jetbrains/mps/util/io/ModelInputStream.java#L187

It seems that PersistenceFacade.getInstance() is null.

This could be perhaps related to a previous error:

PersistentEnumerator storage corrupted /Users/federico/repos/mpsserver/example/build/mps/system/index/mps.nodeusage/mps.NodeUsage.storage
com.intellij.util.io.PersistentEnumeratorBase$CorruptedException: PersistentEnumerator storage corrupted /Users/federico/repos/mpsserver/example/build/mps/system/index/mps.nodeusage/mps.NodeUsage.storage
        at com.intellij.util.io.PersistentEnumeratorBase.<init>(PersistentEnumeratorBase.java:221)
        at com.intellij.util.io.PersistentBTreeEnumerator.<init>(PersistentBTreeEnumerator.java:73)
        at com.intellij.util.io.PersistentEnumeratorDelegate.<init>(PersistentEnumeratorDelegate.java:47)
        at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:149)
        at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:138)
        at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:129)
        at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:121)
        at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:114)
        at com.intellij.util.indexing.impl.ValueContainerMap.<init>(ValueContainerMap.java:38)
        at com.intellij.util.indexing.impl.MapIndexStorage$2.<init>(MapIndexStorage.java:95)
        at com.intellij.util.indexing.impl.MapIndexStorage.initMapAndCache(MapIndexStorage.java:95)
        at com.intellij.util.indexing.VfsAwareMapIndexStorage.initMapAndCache(VfsAwareMapIndexStorage.java:79)
        at com.intellij.util.indexing.VfsAwareMapIndexStorage.<init>(VfsAwareMapIndexStorage.java:74)
        at com.intellij.util.indexing.FileBasedIndexImpl.initIndexStorage(FileBasedIndexImpl.java:393)
        at com.intellij.util.indexing.FileBasedIndexImpl.registerIndexer(FileBasedIndexImpl.java:369)
        at com.intellij.util.indexing.FileBasedIndexImpl.access$5300(FileBasedIndexImpl.java:107)
        at com.intellij.util.indexing.FileBasedIndexImpl$FileIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexImpl.java:2448)
        at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.executeNestedInitializationTask(IndexInfrastructure.java:173)
        at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.runParallelNestedInitializationTasks(IndexInfrastructure.java:161)
        at com.intellij.util.indexing.IndexInfrastructure$DataInitialization.call(IndexInfrastructure.java:122)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:222)
        at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:30)
        at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:201)
        at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
        at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:190)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

Consider that I have cleaned everything, including that supposedly corrupted file and I still get this error running the generate task on a fresh checkout

@coolya
Copy link
Contributor

coolya commented May 18, 2020

Thats pretty strange, this could only happen if the kernel plugin wouldn't get initialized at all, which usually would result in all kind of other errors. Might be a problem with initialization order that find usages is loaded before the kernel is fully initialized. But is seems like the error is anyway only thrown when the idea application is ready disposing. Did it generate any files? If no there might be an error before, or for some reason MPS decided that our default "guess" on the facets involved in the make session isn't enough for your set up. I will check that first, at least the error seems unrelated to generating the project. Unfortunately there is a little bit of hit and miss involved when running the make session from the command line as collecting the involved facets is tricky.

That PersistentEnumerator error we see is pretty much unrelated. It complains that the persistent index for find usage is corrupt which in the worst cast would only result in a performance problem.

@ftomassetti
Copy link
Author

The project is actually very simple: it contains a simple language and one sandbox.

These are the logs with the project open:

Project '.' is opened
Post-startup activities under progress took 37ms; general responsiveness: ok; EDT responsiveness: ok
Saving of the repository took 0.002 s
File system reload finished in 0.001 s
Running Update Task : loaders [toLoad: 1; toUnload:0]; contributors : [toLoad: 0; toUnload:0]; Thread[AWT-EventQueue-0,6,main]
Loading of 122 plugins took 0.083 s
flushing events
nothing to generate
Running Update Task : loaders [toLoad: 0; toUnload:1]; contributors : [toLoad: 0; toUnload:0]; Thread[AWT-EventQueue-0,6,main]
Unloading of 122 plugins took 0.003 s
Project '.' is closing

It seems to say there is nothing to generate

@coolya
Copy link
Contributor

coolya commented May 25, 2020

I have a suspicion what the problem is. I haven't gotten around to fix, unfortunately my time for the side projects is limited at the moment. Do you need this problem fixed in 2019.3 or would it be enough to fix it for 2020.1 and forward?

@ftomassetti
Copy link
Author

I am currently using 2019.3 on this project, we no date set for migration, but at some point we will migrate, I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants