labthings / labthings/labthings-fastapi

LogRecord objects can interfere with garbage collection and cause internal server errors.

Open
#64 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

LogRecord objects can hold arbitrary arguments - we should probably call getMessage() in our custom handler and store only the string, rather than hanging on to the LogRecord object. This will also simplify serialising the logs later, because getMessage() can raise exceptions, so it should be called when the log is handled, not when the list of logs is serialised.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the custom log handler and the code that stores and serialises its logs. Trace when LogRecord objects are retained and when getMessage() is called; done means the handler stores only the resulting string and later serialisation no longer retains LogRecord arguments or triggers the described errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.