Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/appsec/contrib_appsec/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class Test_FastAPI(utils.Contrib_TestClass_For_Threats):
@pytest.fixture
def interface(self, tracer, printer):
def interface(self, printer):
from fastapi.testclient import TestClient

# for fastapi, test tracer needs to be set before the app is created
Expand Down
4 changes: 4 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ def pop(self):
spans = DummyWriterMixin.pop(self)
if self._trace_flush_enabled:
flush_test_tracer_spans(self)
self._inner_writer.before_fork()
return spans

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

def pop_traces(self):
Expand Down
Loading