Terminating provider process

Jan Safranek <[email protected]> Wed, 15 May 2013 15:45:22 +0200
Newsgroups gmane.network.open-pegasus.general
Message-ID <[email protected]>
I use cmpi-bindings to write CMPI providers in Python to speed up the
development. I noticed that Pegasus unloads providers in 15 minutes. Ok,
that's reasonable. The provider process itself then lives for another 15
minutes before it is destroyed.

My problem is that Python cannot un-initialize itself properly and the
next initialization in the same process crashes. So I get a crash if my
provider gets a request in these 15 minutes when it's unloaded by the
provider process but the provider process still exists.

Would it be possible to shut down the provider process immediately when
the last provider is unloaded? Either via (new) configuration option or
compile-time option? I peeked at the code and it seems it's not that
easy to do so, as ProviderAgent::unloadIdleProvidersHandler runs in a
worker thread and I haven't found a way to signal the main thread
(waiting in ProviderAgent::_readAndProcessRequest()) to shut down, but I
think this can be solved.

I can contribute the code if needed, I just need a bit of guidance how
to interrupt readAndProcessRequest() in a nice way.

Sure, I can keep the Python provider in memory forever, but I would like
to destroy it if it is not used, it can take a lot of memory over time.

Jan