Is it possible that approximations would help in this scenario?

I have a dotnet process that communicates with a Java process via unmanaged dll calls.

In some cases, the Java process seems to crash and interrupt my dotnet process. No exceptions are thrown, the process just dies. After a crash java creates a log file with names like "hs_err_pid3228" etc.

Having received no satisfaction from a vendor that provides an unmanaged dll and a java process, I boil down to trying to mitigate an issue that would require providing calls to the java process if they fail, don't take down my process.

After reading various articles, appdomains seems like a likely candidate for use - my theory is that I can, with a little work, detach my functionality that calls the Java process and runs it in a separate application, which will hopefully allow me, if not to catch the appdomain down to at least detect that this has happened and restart this functionality.

Has anyone had the same problem? Does this approach seem like a sane one to those of you with more experience with appdomain?

To make it even more fun, the Java crash is not actually reproducible - it seems very random and I am still struggling with how I am going to pass the appdomain dividing test

+2


source to share


2 answers


This is a smart use of AppDomains and what you suggest will work.

In a similar vein, I once used AppDomains to create a single application that monitored failure for exception reporting purposes. The application started, created a new AppDomain, and then re-executed it on the new AppDomain, which then found it started on the AppDomain and executed fine. When an exception occurs in this AppDomain, the initial process is notified, it plucks the child domain reports to the user that an error has occurred, asks if they want to report it or not, and then picked itself up and tried again.



EDIT: To give you a headgear if you want to look at the Program.cs for this project , I have uploaded a stripped-down version here . (It's quite long, so I didn't think I should post it here.)

+1


source


Yes, using AppDomains makes a lot of sense here.



I recently redesigned my Windows Service to load its various WCF services as plugins that run within their own AppDomain. I have a few cases during the bootstrap process where I use MarshalByRefObjects to start and run, but once the plugins are loaded, communication between AppDomains is extremely convenient using WCF.

0


source







All Articles