#9020 defect closed duplicate (duplicate)

globalLogBeginner should dramatically limit its buffer

Reported by: pjenvey Owned by:
Priority: high Milestone:
Component: logger Keywords:
Cc: Branch:
Author:

Description

Consider a long running twisted app with heavy logging to the globalLogPublisher.

If said app has not called beginLoggingTo of globalLogBeginner it will always buffer the default LimitedHistoryLogObserver size of raw log events: currently a whopping 65k.

This might not be that uncommon: if you've migrated from legacy twisted logging it may not be obvious that anything more needs to be done than calling a global addObserver. And or you may read the new logging docs and follow the instructions for calling addObserver while neglecting the *following* section about the beginner.

https://github.com/search?l=Python&q=globalLogPublisher.addObserver&ref=searchresults&type=Code

This can potentially cause *lots* of useless garbage to hang around the richer your log events are. Raw events might even reference their parent Logger/associated source (even more garbage not being cleaned up):

https://twistedmatrix.com/documents/16.3.1/api/twisted.logger.Logger.html#__get__

A mark and sweep-like GC (like PyPy's) might especially have a lot more work to do.. I suggest limiting the global buffer to something more like 256. Maybe the docs could be clearer too.

Change History (2)

comment:1 Changed 11 months ago by Jean-Paul Calderone

This seems like a duplicate of https://twistedmatrix.com/trac/ticket/8164

comment:2 Changed 11 months ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.