Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: dictionary changed size during iteration #89

Open
nirradi opened this issue Jul 25, 2022 · 0 comments
Open

RuntimeError: dictionary changed size during iteration #89

nirradi opened this issue Jul 25, 2022 · 0 comments

Comments

@nirradi
Copy link

nirradi commented Jul 25, 2022

Code:


app = FastAPI(
    title='Service',
    version=__version__,
)


@app.on_event("startup")
def startup_event():
    print('Will configure logging now')
    json_logging.init_fastapi(enable_json=True)
    
    logger = logging.getLogger()
    syslog = logging.StreamHandler(sys.stdout)
    logger.addHandler(syslog)

Every log now has this error:

    return fmt.format(record)
  File "/usr/local/lib/python3.10/site-packages/json_logging/formatters.py", line 60, in format
    log_object = self._format_log_object(record, request_util=json_logging._request_util)
  File "/usr/local/lib/python3.10/site-packages/json_logging/formatters.py", line 151, in _format_log_object
    "correlation_id": request_util.get_correlation_id(within_formatter=True),
  File "/usr/local/lib/python3.10/site-packages/json_logging/util.py", line 137, in get_correlation_id
    request = self.get_request_from_call_stack()
  File "/usr/local/lib/python3.10/site-packages/json_logging/util.py", line 190, in get_request_from_call_stack
    for key in f_locals:
RuntimeError: dictionary changed size during iteration
Call stack:
....
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

No branches or pull requests

1 participant