/modulerefs
should show all the reasons a module is reffed, but I've frequently seen where a module has a positive use count and this command returns no entries for the module, indicating an accounting error somewhere.
Example:
/reload mod_asterisk_queues
[2024-01-08 07:02:01.197] DEBUG[68685]: module.c:785 unload_resource_nolock: Module mod_asterisk_queues.so has use count 1
[2024-01-08 07:02:01.197] WARNING[68685]: module.c:819 unload_resource_nolock: Soft unload failed, 'mod_asterisk_queues.so' has use count 1
[2024-01-08 07:02:01.197] DEBUG[68685]: cli.c:227 bbs_cli_exec: Command 'reload mod_asterisk_queues' returned 1
/modulerefs mod_asterisk_queues
Module # PR Reffing Module Ref Location
Module 'mod_asterisk_queues' not found
This is not the same issue, but this does seem related:
/reload mod_http
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:816 unload_resource_nolock: Module mod_http.so has use count 2 (force: 1)
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:723 unload_dependencies: Adding net_http.so to unload list, since it depends on mod_http.so
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:723 unload_dependencies: Adding net_ws.so to unload list, since it depends on mod_http.so
[2024-04-22 13:31:59.199] -- Unloading net_ws.so, since it depends on mod_http.so
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:816 unload_resource_nolock: Module net_ws.so has use count 0 (force: 1)
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:855 unload_resource_nolock: Unloading net_ws.so
[2024-04-22 13:31:59.199] DEBUG[3452978]: module.c:775 dec_refcounts: net_ws no longer depends on module mod_http.so
[2024-04-22 13:31:59.200] DEBUG[3452978]: module.c:775 dec_refcounts: net_ws no longer depends on module net_http.so
[2024-04-22 13:31:59.200] ERROR[3452978]: module.c:206 log_module_ref: Failed to find existing reference for net_http.so with pair ID 0
[2024-04-22 13:31:59.200] ERROR[3452978]: module.c:240 __bbs_module_unref: Failed assertion mod->usecount >= 0
[2024-04-22 13:31:59.200] DEBUG[3216596]: socket.c:704 tcp_multilistener: TCP multilistener is now watching 11 sockets
[2024-04-22 13:31:59.239] ERROR[3452978]: backtrace.c:263 bbs_log_backtrace: Got 14 backtrace records
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 0: lbbs bbs_log_backtrace()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 1: lbbs __bbs_assert_fatal()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 2: lbbs <unknown>()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 3: lbbs <unknown>()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 4: lbbs <unknown>()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 5: lbbs <unknown>()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 6: lbbs <unknown>()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 7: lbbs bbs_module_reload()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 8: lbbs bbs_cli_exec()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 9: [0x7fe91c380ef9] mod_sysop.so mod_sysop.c:183 sysop_command()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 10: [0x7fe91c381953] mod_sysop.so mod_sysop.c:438 sysop_handler()
[2024-04-22 13:31:59.576] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 11: lbbs <unknown>()
[2024-04-22 13:31:59.577] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 12: [0x7fe92ec2e044] libc.so.6 pthread_create.c:442 start_thread()
[2024-04-22 13:31:59.577] ERROR[3452978]: backtrace.c:287 bbs_log_backtrace: 13: [0x7fe92ecae61c] libc.so.6 clone3.S:83 clone3()
You must be