Log if we ever gc.freeze() (#19440)
Spawning from
https://github.com/element-hq/synapse-small-hosts/issues/348 where some
test appears to be flaky because some homeserver objects are frozen in
the garbage collector.
We set
[`freeze=False`](a9a6869aa9/multi_synapse/app/shard.py (L319-L321))
in the [Synapse Pro for small
hosts](https://docs.element.io/latest/element-server-suite-pro/synapse-pro-for-small-hosts/overview/)
code but I just want to use this log to make extra sure this isn't being
run somehow. The follow-up here would be to see what else would cause
something to be frozen in the garbage collector.
This commit is contained in:
1
changelog.d/19440.misc
Normal file
1
changelog.d/19440.misc
Normal file
@@ -0,0 +1 @@
|
||||
Add log to explain when and why we freeze objects in the garbage collector.
|
||||
@@ -776,6 +776,11 @@ async def start(hs: "HomeServer", *, freeze: bool = True) -> None:
|
||||
#
|
||||
# PyPy does not (yet?) implement gc.freeze()
|
||||
if hasattr(gc, "freeze"):
|
||||
logger.info(
|
||||
"garbage collector: Freezing all allocated objects in the hopes that (almost) "
|
||||
"everything currently allocated are things that will be used by the homeserver "
|
||||
"for the rest of time. Doing so means less work each GC (hopefully)."
|
||||
)
|
||||
gc.collect()
|
||||
gc.freeze()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user