On 08/02/18 02:39, Graham Dumpleton wrote:
> What are you setting the thread name too?

Beside the mod_wsgi threads running "application()", my code creates
tons of long term threads like "cache_cleanup",
"periodic_cache_flush_to_disk", "map generation workers", "audio
transcoding", etc.

> https://github.com/GrahamDumpleton/mod_wsgi/issues/160

Uhm, first thing in "application()" could be a "thread.name=URI", and
the "finally" statement could be "thread.name='idle'", or in the
"close()" code of the iterator returned.

This looks like a pattern for a near trivial middleware.

> If you are logging thread ID in access log, then setting thread ID to
> request ID and attaching it to the traceback sounds reasonable.

I am looking for being able to easily identify my threads in a
"request-timeout" traceback dump when I have like 130 threads running.
They are nicely labeled in my code, but the mod_wsgi traceback dump
doesn't show the "name" field, but opaque and uninformative "thread.ident".

I have a "futures._WorkItem" overloaded to accept an extra "thread_name"
parameter in the "futures.executor.submit()" so I can annotate threads
doing background work.

Now that I am using "request-timeout" traceback dumps, I would love to
have all that information available. Just dump "thread.name" if
available, instead of "thread.ident" :-).

-- 
Jesús Cea Avión                         _/_/      _/_/_/        _/_/_/
[email protected] - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
Twitter: @jcea                        _/_/    _/_/          _/_/_/_/_/
jabber / xmpp:[email protected]  _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to