res_pjsip_exten_state,res_pjsip_mwi: Allow unload on shutdown
Commit f66f77f
last year prevents the res_pjsip_exten_state and
res_pjsip_mwi modules from unloading due to possible pjproject
asserts if the modules are reloaded. A side effect of the
implementation is that the taskprocessors these modules use aren't
being released. When asterisk is doing a graceful shutdown, it
waits AST_TASKPROCESSOR_SHUTDOWN_MAX_WAIT seconds for all
taskprocessors to stop but since those 2 modules don't release
theirs, the shutdown hangs for that amount of time.
This change allows the modules to be unloaded and their resources to
be released when ast_shutdown_final is true.
Resolves: #379
This commit is contained in:
parent
f89e56c178
commit
9efc4bdfbc
|
@ -973,7 +973,18 @@ static int publisher_stop(struct ast_sip_outbound_publish_client *client)
|
|||
|
||||
static int unload_module(void)
|
||||
{
|
||||
#if 0
|
||||
/*
|
||||
* pjsip_evsub_register_pkg is called by ast_sip_register_subscription_handler
|
||||
* but there is no corresponding unregister function, so unloading
|
||||
* a module does not remove the event package. If this module is ever
|
||||
* loaded again, then pjproject will assert and cause a crash.
|
||||
* For that reason, we must only be allowed to unload when
|
||||
* asterisk is shutting down. If a pjsip_evsub_unregister_pkg
|
||||
* API is added in the future then we should go back to unloading
|
||||
* the module as intended.
|
||||
*/
|
||||
|
||||
if (ast_shutdown_final()) {
|
||||
ast_sip_unregister_event_publisher_handler(&dialog_publisher);
|
||||
ast_sip_unregister_subscription_handler(&dialog_handler);
|
||||
ast_sip_unregister_event_publisher_handler(&presence_publisher);
|
||||
|
@ -988,18 +999,9 @@ static int unload_module(void)
|
|||
publishers = NULL;
|
||||
|
||||
return 0;
|
||||
#else
|
||||
/* If we were allowed to unload, the above is what we would do.
|
||||
* pjsip_evsub_register_pkg is called by ast_sip_register_subscription_handler
|
||||
* but there is no corresponding unregister function, so unloading
|
||||
* a module does not remove the event package. If this module is ever
|
||||
* loaded again, then pjproject will assert and cause a crash.
|
||||
* For that reason, we must not be allowed to unload, but if
|
||||
* a pjsip_evsub_unregister_pkg API is added in the future
|
||||
* then we should go back to unloading the module as intended.
|
||||
*/
|
||||
} else {
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static int load_module(void)
|
||||
|
|
|
@ -1524,7 +1524,18 @@ static int reload(void)
|
|||
|
||||
static int unload_module(void)
|
||||
{
|
||||
#if 0
|
||||
/*
|
||||
* pjsip_evsub_register_pkg is called by ast_sip_register_subscription_handler
|
||||
* but there is no corresponding unregister function, so unloading
|
||||
* a module does not remove the event package. If this module is ever
|
||||
* loaded again, then pjproject will assert and cause a crash.
|
||||
* For that reason, we must only be allowed to unload when
|
||||
* asterisk is shutting down. If a pjsip_evsub_unregister_pkg
|
||||
* API is added in the future then we should go back to unloading
|
||||
* the module as intended.
|
||||
*/
|
||||
|
||||
if (ast_shutdown_final()) {
|
||||
struct ao2_container *unsolicited_mwi;
|
||||
|
||||
ast_sorcery_observer_remove(ast_sip_get_sorcery(), "global", &global_observer);
|
||||
|
@ -1549,18 +1560,9 @@ static int unload_module(void)
|
|||
ast_free(default_voicemail_extension);
|
||||
default_voicemail_extension = NULL;
|
||||
return 0;
|
||||
#else
|
||||
/* If we were allowed to unload, the above is what we would do.
|
||||
* pjsip_evsub_register_pkg is called by ast_sip_register_subscription_handler
|
||||
* but there is no corresponding unregister function, so unloading
|
||||
* a module does not remove the event package. If this module is ever
|
||||
* loaded again, then pjproject will assert and cause a crash.
|
||||
* For that reason, we must not be allowed to unload, but if
|
||||
* a pjsip_evsub_unregister_pkg API is added in the future
|
||||
* then we should go back to unloading the module as intended.
|
||||
*/
|
||||
} else {
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static int load_module(void)
|
||||
|
|
Loading…
Reference in New Issue