Skip to content

Commit 756bab1

Browse files
chore(utils): stop threads in dummy writer
1 parent ee8f34d commit 756bab1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,7 @@ def pop(self):
644644
spans = DummyWriterMixin.pop(self)
645645
if self._trace_flush_enabled:
646646
flush_test_tracer_spans(self)
647+
self._inner_writer.before_fork()
647648
return spans
648649

649650
def recreate(self, appsec_enabled: Optional[bool] = None) -> "DummyWriter":
@@ -745,6 +746,9 @@ def get_spans(self):
745746
def pop(self):
746747
# type: () -> List[Span]
747748
spans = self._span_aggregator.writer.pop()
749+
# Stop the writer threads in case the writer is no longer used.
750+
# Otherwise we risk accumulating threads and file descriptors causing crashes
751+
# In case the writer is used again it will be restarted by native side.
748752
return spans
749753

750754
def pop_traces(self):

0 commit comments

Comments
 (0)