Hide Forgot
the prototype for lib_init_fn allows to return errors when a client -> lib -> IPC -> service connection fails/should be rejected, but at IPC level (within corosync exec/ipc_glue.c) the return code for lib_init_fn is ignored. There is no warning or no failure propagation. This removes completely the possibility for a service to report failures down the line when creating new connections to the service. The client would always be able to connect, while in reality the service might have failed to allocate resources to serve those requests and there is no sign/track of it anywhere.
You say that but there is not a single init function that does that (all do very basic init and return 0). Any memory allocation for the connection should be contained in the context (accessed via api->ipc_private_data_get (conn)) this is refcounted and allocated/freed by the ipc system. I would say a bigger problem is the possible failures in cs_ipcs_connection_created(), as there is quite a bit going on there.
(In reply to comment #1) > You say that but there is not a single init function that > does that (all do very basic init and return 0). That's because I had to change votequorum and plugin loading service to work around this problem and be able to move forward. It is still incorrect to ignore the return code and future code might require this to work as expected. Alternatively change lib_init_fn prototype to void, at least it's clear that a plugin must be able to handle an incoming connection (tho I think this is the wrong approach).
the return code should be handled memory should not be allocated in lib_init_fn in general - this is what private data is for There may be cases where a lib_init function calls an init that allocates memory - nothing we can do about that and need to handle these failures While this is more like an rfe, it seems like the right thing to do. Regards -steve
Here is the patch that fixes the issue: https://github.com/corosync/corosync/commit/45cb05f1add8d9983777f5e040232b05cc95d0c5 For best results it needs: https://github.com/asalkeld/libqb/commit/7d9df9ef74b8f206f62ff260510f01fcb99208a1