Skip to content

[Bug] Send trace data fail because context.cancel() early #774

@lifepuzzlefun

Description

@lifepuzzlefun

BUG REPORT

  1. Please describe the issue you observed:

master code.
local cluster.
example/producer/trace/main.go

  1. Please tell us about your environment:

  2. Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):

see master code

var req = td.buildSendRequest(mq, msg)
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
err := td.cli.InvokeAsync(ctx, addr, req, func(command *remote.RemotingCommand, e error) {
resp := primitive.NewSendResult()
if e != nil {
rlog.Info("send trace data error.", map[string]interface{}{
"traceData": data,
})
} else {
td.cli.ProcessSendResponse(mq.BrokerName, command, resp, msg)
rlog.Debug("send trace data success:", map[string]interface{}{
"SendResult": resp,
"traceData": data,
})
}
})
if err != nil {
rlog.Info("send trace data error when invoke", map[string]interface{}{
rlog.LogKeyUnderlayError: err,
})
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions