0

I have C++ library that handles queries to documents and ASP.NET 5(.NET Core) web server that should open and query documents using that library.

I want to isolate C++ library from web server (so if library crashes it won't crash the server). So I'm thinking about spawning separate process for each open document and pass queries to those processes using sockets.

The question is: how and where should I handle process spawning and managing? Is it better to do on C# side, on C++, or use some middle ware?. Is there any libraries that can help me to manage processes, kill frozen processes, keep extra processes alive, and so on?

Roman Kolesnikov
  • 11,777
  • 11
  • 44
  • 67

1 Answers1

1

Spawning a process is the right way to do it. That way you don't risk the external library taking down your server process. Of course, you're still exposed to the external process messing up the environment completely (like crashing the OS) but that's orthogonal to this.

Since you tagged the question with asp.net-5 I assume you're using it. While there's nothing out, at least not in what Microsoft ships as part of ASP.NET 5, for managing processes from your web server you can take a look at the code for dnx-watch. The watcher manages an external process.

Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
  • Thanks a lot! ProcessWatcher looks like a good start point to write ProcessManager in C#. But I suppose to write stable crossplatform process manager has many nuances, so I firstly seek more mature solutions before implementation of my own. – Roman Kolesnikov Nov 25 '15 at 06:51