Skip to content

Use copied env in events #1186

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

Merged
merged 2 commits into from
Jan 7, 2021
Merged

Use copied env in events #1186

merged 2 commits into from
Jan 7, 2021

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Jan 6, 2021

Because Sentry now prepares/sends events in the background, sharing the same env object with the main thread means that the background worker & the main thread could process it at the same time. And since env is essentially a Hash object, this will trigger the:

RuntimeError: can't add a new key into hash during iteration

Hopefully, this can fix #1183.

(It's possible that such issues could also be caused by sharing the underlying hash values, like params. But deep-copying the entire env hash could be costly so I want to see if this fix works first.)

st0012 added 2 commits January 6, 2021 15:30
Because Sentry now prepares/sends events in the background, sharing the
same env object with the main thread means that the background worker &
the main thread could process it at the same time. And since env is
essentially a Hash object, this will trigger the

```
RuntimeError: can't add a new key into hash during iteration
```
@st0012 st0012 added this to the 4.1.3 milestone Jan 6, 2021
@st0012 st0012 self-assigned this Jan 6, 2021
@st0012 st0012 merged commit 611f1a2 into master Jan 7, 2021
@st0012 st0012 deleted the use-copied-env-in-events branch January 7, 2021 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RuntimeError: can't add a new key into hash during iteration in middleware
1 participant