BundleModuleSource is not properly synchronized
Multiple threads may read and write the state of BundleModuleSource
object. Access must be synchronized to prevent errors like this:
ERROR [2025-01-30 09:34:37,542] org.simantics.db.common.procedure.wrapper.SyncToAsyncListener: SyncToAsyncListener -> http://semantum.fi/SimupediaServerStandardLibrary@1.56.0/SCLMain null (true) [class org.simantics.modeling.scl.GraphModuleSourceRepository$ModuleListener] failed
java.lang.IllegalArgumentException: Equal objects must have equal hashcodes. During rehashing, Trove discovered that the following two objects claim to be equal (as in java.lang.Object.equals()) but their hashCodes (or those calculated by your TObjectHashingStrategy) are not equal.This violates the general contract of java.lang.Object.hashCode(). See bullet point two in that method's documentation. object #1 =class org.simantics.scl.compiler.module.repository.ModuleRepository$ModuleEntry id= 907438604 hashCode= 907438604 toString= ModuleEntry@XYZ@907438604; object #2 =class org.simantics.scl.compiler.module.repository.ModuleRepository$ModuleEntry id= 907438604 hashCode= 907438604 toString= ModuleEntry@XYZ@907438604
Inserting same object twice, rehashing bug. Object= ModuleEntry@XYZ@907438604
at gnu.trove.impl.hash.TObjectHash.buildObjectContractViolation(TObjectHash.java:464)
at gnu.trove.impl.hash.TObjectHash.throwObjectContractViolation(TObjectHash.java:448)
at gnu.trove.set.hash.THashSet.rehash(THashSet.java:172)
at gnu.trove.impl.hash.THash.postInsertHook(THash.java:388)
at gnu.trove.set.hash.THashSet.add(THashSet.java:112)
at org.simantics.scl.osgi.internal.BundleModuleSource.getSourceStream(BundleModuleSource.java:103)
at org.simantics.scl.compiler.source.EncodedTextualModuleSource.getSourceReader(EncodedTextualModuleSource.java:27)
at org.simantics.scl.compiler.source.TextualModuleSource.getSourceText(TextualModuleSource.java:59)
at org.simantics.scl.compiler.source.TextualModuleSource.compileModule(TextualModuleSource.java:90)
at org.simantics.scl.compiler.module.repository.ModuleRepository$ModuleEntry.initModuleEntryAndAddListener(ModuleRepository.java:173)
at org.simantics.scl.compiler.module.repository.ModuleRepository.getModuleEntry(ModuleRepository.java:285)
at org.simantics.scl.compiler.module.repository.ModuleRepository.getModuleEntries(ModuleRepository.java:313)
at org.simantics.scl.compiler.module.repository.ModuleRepository.createRuntimeEnvironment(ModuleRepository.java:425)
at org.simantics.scl.compiler.module.repository.ModuleRepository.createRuntimeEnvironment(ModuleRepository.java:415)
at org.simantics.db.layer0.util.RuntimeEnvironmentRequest2.getRuntimeEnvironment(RuntimeEnvironmentRequest2.java:97)
at org.simantics.db.layer0.util.RuntimeEnvironmentRequest2$UpdateListenerImpl.notifyAboutUpdate(RuntimeEnvironmentRequest2.java:58)
at org.simantics.scl.compiler.module.repository.ModuleRepository$ModuleEntry.notifyAboutUpdate(ModuleRepository.java:124)
at org.simantics.modeling.scl.GraphModuleSourceRepository$ModuleListener.fireUpdate(GraphModuleSourceRepository.java:84)
at org.simantics.modeling.scl.GraphModuleSourceRepository$ModuleListener.execute(GraphModuleSourceRepository.java:95)
at org.simantics.modeling.scl.GraphModuleSourceRepository$ModuleListener.execute(GraphModuleSourceRepository.java:1)
at org.simantics.db.common.procedure.wrapper.SyncToAsyncListener$1.run(SyncToAsyncListener.java:41)
at org.simantics.db.common.request.ReadRequest.perform(ReadRequest.java:21)
at org.simantics.db.impl.query.ReadEntry.computeForEach(ReadEntry.java:125)
... 4 common frames omitted