Skip to content

Commit 58aa180

Browse files
committed
fix: install atexit handlers after apps are initialized
1 parent 1eb8615 commit 58aa180

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

core/uwsgi.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,13 +3202,12 @@ int uwsgi_start(void *v_argv) {
32023202
//init apps hook (if not lazy)
32033203
if (!uwsgi.lazy && !uwsgi.lazy_apps) {
32043204
uwsgi_init_all_apps();
3205+
// Register uwsgi atexit plugin callbacks after all applications have
3206+
// been loaded. This ensures plugin atexit callbacks are called prior
3207+
// to application registered atexit callbacks.
3208+
atexit(uwsgi_plugins_atexit);
32053209
}
32063210

3207-
// Register uwsgi atexit plugin callbacks after all applications have
3208-
// been loaded. This ensures plugin atexit callbacks are called prior
3209-
// to application registered atexit callbacks.
3210-
atexit(uwsgi_plugins_atexit);
3211-
32123211
if (!uwsgi.master_as_root) {
32133212
uwsgi_log("dropping root privileges after application loading\n");
32143213
uwsgi_as_root();
@@ -3553,6 +3552,11 @@ void uwsgi_worker_run() {
35533552

35543553
if (uwsgi.lazy || uwsgi.lazy_apps) {
35553554
uwsgi_init_all_apps();
3555+
3556+
// Register uwsgi atexit plugin callbacks after all applications have
3557+
// been loaded. This ensures plugin atexit callbacks are called prior
3558+
// to application registered atexit callbacks.
3559+
atexit(uwsgi_plugins_atexit);
35563560
}
35573561

35583562
// some apps could be mounted only on specific workers

0 commit comments

Comments
 (0)