Skip to content

Improve log message around interpreter attach/cleanup/destroy#943

Open
michael-o wants to merge 1 commit intoGrahamDumpleton:developfrom
michael-o:main-sub-interpreter
Open

Improve log message around interpreter attach/cleanup/destroy#943
michael-o wants to merge 1 commit intoGrahamDumpleton:developfrom
michael-o:main-sub-interpreter

Conversation

@michael-o
Copy link
Contributor

Improve log by saying whether a main interpreter is created or a named one (subinterpreter).

Output:

httpd-error.log:2026-02-15 01:15:17.587531 [pid: 47513, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47513): Attach main interpreter.
httpd-error.log:2026-02-15 01:15:17.587837 [pid: 47514, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47514): Attach main interpreter.
httpd-error.log:2026-02-15 01:15:17.587984 [pid: 47515, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47515): Attach main interpreter.
httpd-error.log:2026-02-15 01:15:18.594050 [pid: 47519, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47519): Attach main interpreter.
httpd-error.log:2026-02-15 01:16:20.537041 [pid: 47519, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47519): Cleanup main interpreter.
httpd-error.log:2026-02-15 01:16:20.537069 [pid: 47513, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47513): Cleanup main interpreter.
httpd-error.log:2026-02-15 01:16:20.537110 [pid: 47514, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47514): Cleanup main interpreter.
httpd-error.log:2026-02-15 01:16:20.537823 [pid: 47515, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47515): Cleanup main interpreter.
httpd-error.log:2026-02-15 01:16:21.570549 [pid: 47781, tid: 35056574464] [wsgi:info] mod_wsgi (pid=47781): Attach main interpreter.
httpd-error.log:2026-02-15 01:16:21.570815 [pid: 47782, tid: 35056574464] [wsgi:info] mod_wsgi (pid=47782): Attach main interpreter.
httpd-error.log:2026-02-15 01:16:21.570829 [pid: 47783, tid: 35056574464] [wsgi:info] mod_wsgi (pid=47783): Attach main interpreter.
httpd-error.log:2026-02-15 01:16:22.635472 [pid: 47785, tid: 35056574464] [wsgi:info] mod_wsgi (pid=47785): Attach main interpreter.
kona-dev.innomotics.net-error.log:2026-02-15 01:15:17.587854 [pid: 47512, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47512): Attach main interpreter.
kona-dev.innomotics.net-error.log:2026-02-15 01:16:21.038598 [pid: 47512, tid: 35046014976] [wsgi:info] mod_wsgi (pid=47512): Cleanup main interpreter.
kona-dev.innomotics.net-error.log:2026-02-15 01:16:21.571154 [pid: 47780, tid: 35056574464] [wsgi:info] mod_wsgi (pid=47780): Attach main interpreter.

I intentionally haven't used the term subinterpreter because it would have been inconsistent with the rest of the log message. It needs to be done consistently throughout.

This fixes #942.

Improve log by saying whether a main interpreter is created or a named
one (subinterpreter).

This fixes GrahamDumpleton#942
@michael-o michael-o force-pushed the main-sub-interpreter branch from fb4d4b8 to 7da40c4 Compare February 15, 2026 00:20
}
else {
ap_log_error(APLOG_MARK, APLOG_INFO, 0, wsgi_server,
"mod_wsgi (pid=%d): Destroy main interpreter.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% whether destroy is also subject to main/sub handling.

@GrahamDumpleton
Copy link
Owner

The distinction that it is a sub interpreter is actually meaningful as many people using Python don't even realise there are sub interpreters. I will need to check logging elsewhere bit maybe then should be:

Initialize main interpreter.
Destroy main interpreter.

and:

Attach sub interpreter 'name'.
Cleanup sub interpreter 'name'.

Sub interpreters hang off the main interpreter so language just needs to be different.

@michael-o
Copy link
Contributor Author

The distinction that it is a sub interpreter is actually meaningful as many people using Python don't even realise there are sub interpreters. I will need to check logging elsewhere bit maybe then should be:

Initialize main interpreter.
Destroy main interpreter.

and:

Attach sub interpreter 'name'.
Cleanup sub interpreter 'name'.

Sub interpreters hang off the main interpreter so language just needs to be different.

Yes, please do. My point is that there a too many places logging about subinterpreters (named ones), ideally this would be consistently. I cannot tell for certain which other statements need to aligned as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty arguments in log messages

2 participants