-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
I have the following test:
val logger: Logger = LoggerFactory.getLogger("RepeatedTest")
Factory.checkApi()
val path = getClass.getResource("/fmus/omodelica/Scalar.fmu").getPath
val fmuFile = new File(path)
val fmu = Factory.create(fmuFile)
fmu.load()
val modDesc = new ModelDescription(fmu.getModelDescription())
for (i <- 0 until 10){
logger.info(s"Attempt: $i")
val instance = fmu.instantiate(modDesc.getGuid(), "fmu", true, false, null)
instance.setupExperiment(false, 0.0, 0.0, true, 1.0)
instance.enterInitializationMode()
instance.exitInitializationMode()
instance.terminate()
instance.freeInstance()
}
fmu.unLoad()
And, when I run it, I get the following non-deterministic result:
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 0
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 1
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 2
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 3
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 4
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 5
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 6
[ScalaTest-run-running-MiscTest] INFO RepeatedTest - Attempt: 7
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000703849e4, pid=7536, tid=0x00000000000018d0
#
# JRE version: Java(TM) SE Runtime Environment (8.0_191-b12) (build 1.8.0_191-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [fmuapi.dll+0x49e4]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Data\Notes\ongoing\DynamicFMUAnalysis\ModelBasedTesting\modbat_example\hs_err_pid7536.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
And file
hs_err_pid7536.log
I stress that this result may not happen (it seems to happen more frequently for larger repetitions.
While I'm not sure what the cause is, I know that the same test with a non null callback does not seem to reproduce the failure (even for 100 repetitions).
So, if I instantiate with a non null callback, the error goes away:
val instance = fmu.instantiate(modDesc.getGuid(), "fmu", true, false, new IFmuCallback() {
override def log(instanceName: String, status: Fmi2Status, category: String, message: String): Unit = {}
override def stepFinished(fmi2Status: Fmi2Status): Unit = {}
})
Perhaps we should just enforce the non-null fmicallback?
While the FMI 2.0 doc does not state explicitly that this argument be null, it says, p. 19
Argument functions provides callback functions to be used from the FMU functions to
utilize resources from the environment (see type fmi2CallbackFunctions below).
[...]
If loggingOn=fmi2True , debug logging is enabled. If loggingOn=fmi2False , debug
logging is disabled. [**The FMU enable/disables LogCategories which are useful for
debugging according to this argument.** Which LogCategories the FMU sets is unspecified.]
Which means that the FMU might deref the callback, even when logging is set to false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels