Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Commented Issue: Cannot create multiple engine instances [37]

$
0
0
Hello,

I get an SEHException when I try to create an engine instance the second time. I'm using R 2.15.3 and R.Net 1.4.0.0.

I have implemented a wrapper that tests on startup if R is installed and if it works. The code for this is

```
using (REngine testInstance = REngine.CreateInstance("test"))
{
Version v = testInstance.DllVersion;
if ((v.Major == 2 && v.Minor >= 15) || v.Major >= 3)
{
_isAvailable = true;
}
}
```

Basically it is to ensure that a specific version of R is used. This happens in a static constructor of the wrapper class and works fine.

Later when really using an engine I create a new instance:

REngine.CreateInstance("Test2")

which throws the SEHException. The error code in the exception is 0x80004005. If I leave out the first engine creation above, the Test2 engine is created and works. I'm using net framework 4.0, VS2010, Win7 64Bit (but I use 32Bit R).

Stacktrace:
at RDotNet.Internals.DirectNativeMethods._setup_Rmainloop()
at RDotNet.Internals.DirectNativeMethods.setup_Rmainloop()
at RDotNet.REngine..ctor(String id, String[] args, CharacterDeviceAdapter adapter)
at RDotNet.REngine.CreateInstance(String id, String[] args, CharacterDeviceAdapter adapter)
at RDotNet.REngine.CreateInstance(String id, String[] args, ICharacterDevice device)
at RDotNet.REngine.CreateInstance(String id, String[] args)
at R2D2.RIntegrator..ctor(String instanceName) in D:\Projects\Consolidation\global\Prototypes\R-Integration\R2D2\RIntegrator.cs:line 91

It seems a known issue, not sure. Can this be solved or work around?

Thanks,
Christian



Comments: I did some more investigation. The SEHException only comes up when the first instance is created in the static constructor. If I do this in the same code block, the instance creation works. But anyway any call to the second engine instance hangs and does not return. Has anybody managed to use more than one instance (not parallel) at all? I will try for now using only one instance only. Is it possible to reinitialize/cleanup an engine instance so that it does not remember any symbols used before?

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>