I am running Asterisk on a Linux server using the PJSIP channel driver. When I start the Asterisk service, I use the following command:
sh /usr/sbin/safe_asterisk >/dev/null </dev/null 2>&1 &
The Asterisk process starts, but the modules take a very long time to initialize and come up. On my other servers, the startup is almost instant, but on this specific server, I have to wait a significant amount of time before the system is ready to process calls.
While the system is stuck in this starting phase, if I attach to the Asterisk CLI and attempt to force a reload using pjsip reload, the command is rejected and I get spammed with the following message in an endless loop:
ISTVATXOBAPLP01*CLI> pjsip reload
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
What exactly triggers the ârequest queuedâ warning when attempting a reload?
If all the modules havenât loaded (because itâs starting up), then you canât reload any. Only after it has started can you reload.
Common issues for this would be networking related, such as DNS, or disk I/O, or CPU stealing, or if a database is in use then database throughput/connectivity.
I am running Asterisk on a Linux server using the PJSIP channel driver. When I start the Asterisk service, I use the following command:
sh /usr/sbin/safe_asterisk >/dev/null </dev/null 2>&1 &
The Asterisk process starts, but the modules take a very long time to initialize and come up. On my other servers, the startup is almost instant, but on this specific server, I have to wait a significant amount of time before the system is ready to process calls.
While the system is stuck in this starting phase, if I attach to the Asterisk CLI and attempt to force a reload using pjsip reload, the command is rejected and I get spammed with the following message in an endless loop:
ISTVATXOBAPLP01*CLI> pjsip reload
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
Asterisk cannot reload a module yet; request queued
What exactly triggers the ârequest queuedâ warning when attempting a reload?
Thank you for your answers. What I am really curious about is why the startup process takes so incredibly long. It literally took about 8-9 hours before Asterisk was finally able to process the queued pjsip reload commands! I have another Asterisk server with the exact same modules loaded, and I donât face this issue there at all.
Here is the exact timeline of what happened. About 5 hours after starting Asterisk, it finally threw this log:
Then, about 4 hours after that crash (9 hours total waiting time), I saw that it finally executed the queued reload requests:
[Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip.soâ. [Mar 11 09:23:59] NOTICE[26313] sorcery.c: Type âsystemâ is not reloadable, maintaining previous values [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_authenticator_digest.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_endpoint_identifier_ip.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_mwi.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_notify.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_outbound_publish.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_publish_asterisk.soâ. [Mar 11 09:23:59] NOTICE[1420] loader.c: Executing deferred reload request for module âres_pjsip_outbound_registration.soâ. [Mar 11 09:23:59] WARNING[26322] pbx_config.c: users.conf is deprecated and will be removed in a future version of Asterisk [Mar 11 09:33:08] NOTICE[26551] sorcery.c: Type âsystemâ is not reloadable, maintaining previous values
After running Asterisk, I checked the module and saw that it was loaded.
[root@ISTVATXOBAPLP01 announce]# asterisk -rx âmodule show like media_cacheâ Module Description Use Count Status Support Level res_http_media_cache.so HTTP Media Cache Backend 1 Running core 1 modules loaded
Given that my other identical server starts instantly, what else could be causing the module loader to hang for hours before reaching âAsterisk Readyâ? How can I trace exactly what Asterisk is waiting for during this massive delay now?
Bucket is what is used by the media cache, so since you saw such output it may very well be that the on-disk media cache has grown quite large on that system. I donât have much experience with it unfortunately, so someone else may be able to provide more details but I do know there are CLI commands prefixed with âmedia cacheâ to interact with it, and âmedia cache show allâ could at least confirm that suspicion.
Thanks everyone for your help! The problem is finally solved.
The tip regarding the media cache was spot on. Our system plays a large number of dynamic TTS audio files directly from HTTP URLs. It turned out that Asteriskâs res_http_media_cache.so module was saving each unique URL to AstDB (under the MediaCache family) indefinitely.
Over time, this database reached tens of thousands of entries. Initially, Asterisk tried to load them all, astobj2 reached the 100,000 refcount limit, triggering a FRACK! crash in bucket.c. This completely locked the module loader for hours, so all pjsip reload commands got stuck in a ârequest queuedâ loop.
Solution:
I cleared the bloated cache from the Asterisk CLI using the following command: database deltree MediaCache
After that, Asterisk started instantly and the reloading problem disappeared.
I have a âhackâ script that cleans up recordings that are older than X amount of days. Every time I tried posting it here the syntaxing came out all messed up. I run it as a cron job every day. You can see it here http://h6315.com/media.txt. I plan on cleaning it up and having it modify the sqlite db directly and removing the file on itâs ownâŚ
On Thursday 12 March 2026 at 14:21:43, Dovid wrote:
I have a âhackâ script that cleans up recordings that are older than X
amount of days. Every time I tried posting it here the syntaxing came out
all messed up. I run it as a cron job every day. You can see it here http://h6315.com/media.txt. I plan on cleaning it up and having it modify
the sqlite db directly and removing the file on itâs ownâŚ
Be careful with connecting to SQLite from multiple clients simultaneously:
âSQLite does let simultaneous access happen, and thereâs no reason why WAL
mode would prevent it, but the people who programmed the applications have to
have had this in mind when they wrote the software: rather than optimize each
program for speed, they have to optimize each program for leaving the database
free. This means using transactions properly: BEGIN, a short burst of
commands, then COMMIT as soon as possible.â
Antony.
â
âRemember: the S in IoT stands for Security.â