Repository navigation
Commit 2bdf631
authored
fix(logger): copy thread-local keys in thread_safe_remove_keys (#8772)
remove_context_keys popped keys out of the dict held by the
THREAD_LOCAL_KEYS ContextVar in place. asyncio tasks and
asyncio.to_thread run in a copy of the caller's context, and that copy
points at the same dict, so removing a key in one of them removed it
for the caller and every other task that copied it.
thread_safe_append_keys and thread_safe_clear_keys already set a new
dict. thread_safe_remove_keys now does the same.1 parent 7a54af5 commit 2bdf631
2 files changed
Lines changed: 29 additions & 1 deletion
File tree
- aws_lambda_powertools/logging
- tests/functional/logger/required_dependencies
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
| 493 | + | |
| 494 | + | |
494 | 495 | | |
495 | 496 | | |
496 | 497 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
486 | 487 | | |
487 | 488 | | |
488 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
489 | 516 | | |
490 | 517 | | |
491 | 518 | | |
| |||
0 commit comments