Describe what you expected:Middleware function should not mutate the returned context of c.UserContext(), which means c.UserContext() should not have any deadline or cancellation signals if not set previously.
Steps to reproduce the issue:
suppose there are 2 servers; s1(localhost:3000), s2(localhost:8080), and s1 sends GET request to s2.
s1 needs to shutdown gracefully. s1 uses Middleware function as below.
@ahmed-mez hello, this is a remind for this issue. I edited the comment and it's my pleasure if you give me some reviews for this issue. if this seems like not a bug, let me close it.
I'm not sure this is a bug or intended.
Version of dd-trace-go
1.56.1
Describe what happened:
after calling
Middleware
function,c.UserContext()
returns*fasthttp.RequestCtx
which carries a deadline a cancellation signal.(https://github.com/gofiber/fiber/blob/master/ctx.go#L443)Describe what you expected:
Middleware
function should not mutate the returned context ofc.UserContext()
, which meansc.UserContext()
should not have any deadline or cancellation signals if not set previously.Steps to reproduce the issue:
suppose there are 2 servers; s1(localhost:3000), s2(localhost:8080), and s1 sends GET request to s2. s1 needs to shutdown gracefully. s1 uses
Middleware
function as below.server 1 (s1)
server 2 (s2)
when sending SIGTERM to s1 during s1 is handling requests, s1 shutdowns immediately, which does not when s1 without
Middleware
function.Additional environment details (Version of Go, Operating System, etc.): Go 1.21.x
Proposal use
c.UserContext()
(https://github.com/gofiber/fiber/blob/master/ctx.go#L451) instead ofc.Context()
(type*fasthttp.RequestCtx
) when start span as below.This matches with other framework's
Middleware
function...net/http https://github.com/DataDog/dd-trace-go/blob/main/contrib/net/http/trace.go#L66 https://github.com/DataDog/dd-trace-go/blob/main/contrib/internal/httptrace/httptrace.go#L61 https://github.com/golang/go/blob/master/src/net/http/request.go#L346
gin https://github.com/DataDog/dd-trace-go/blob/main/contrib/gin-gonic/gin/gintrace.go#L53 https://github.com/DataDog/dd-trace-go/blob/main/contrib/internal/httptrace/httptrace.go#L61 .. (same as net/http)
go-chi https://github.com/DataDog/dd-trace-go/blob/main/contrib/go-chi/chi/chi.go#L54 https://github.com/DataDog/dd-trace-go/blob/main/contrib/internal/httptrace/httptrace.go#L61 .. (same as net/http)