Skip to content

Commit 032a598

Browse files
authored
Fixed bug that server crash when tracer flush failed in defer. (#3228)
* Fixed bug that server crash when tracer flush failed in defer. * Update CHANGELOG-2.1.md
1 parent 7b04509 commit 032a598

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Middleware/TraceMiddleware.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
4545
$span = $this->buildSpan($request);
4646

4747
defer(function () {
48-
$this->tracer->flush();
48+
try {
49+
$this->tracer->flush();
50+
} catch (\Throwable $exception) {
51+
}
4952
});
5053
try {
5154
$response = $handler->handle($request);

0 commit comments

Comments
 (0)