toggle quoted messageShow quoted text
Obviously I would prefer to remain as close as possible to upstream code, so forking is a last resort. That being said, you’ve been so far quite unreceptive to my concerns about crashing as a result of unloading the payload (and transport, for that matter) library code.
The approach of checking if the payload library exists is a bit of a hack, and is not possible currently, since the mamaInternal_findPayload
function is not exposed as part of the API. Are you planning to expose those functions?
A better solution I believe would be separating out the unloading of the library code from the other activities needed to do a clean shutdown. I’ve created a fugly hack for that in the forked OpenMAMA code (see attached), but would much prefer something a bit more “elegant”, which would likely require changing the API, and I don’t want to do that without agreement from you. But so far you haven’t even agreed that this is a problem.
I’m open to ideas, but I think we can do better than what you suggest.
On Dec 28, 2017, at 12:21 PM, Frank Quinn <frank@...
On the contrary I welcome OpenMAMA forks If you want to fork and maintain all fixes etc from the upstream that's entirely your decision and part of the beauty of Open Source software. More power to you.
I simply don't agree that always leaking is the right solution when it's avoidable. It's as simple as that.
After another look I think the solution should live in the C++ destructor method where it can:
1. Cache the payload type in the C++ layer as soon as it is known.
2. On destructor, find out if the bridge referred to in #1 is still active using mamaInternal_findPayload
from mamaMsg_destroy. Therefore the destroy calls can intercept bridge specific calls before they are made which would otherwise cause a crash.
The mama internal lock may also need to be opened up to avoid race conditions.
You can do something similar in Java finalizer methods via a JNI method.
Alternatively you could have a mama property which will simply prevent the payload bridges from being deallocated and will instead only destroy the middleware bridges. This way it will do what you want (i.e. always leak memory), but not be turned on for everyone unless they want it.