{"record":{"id":"5eee6cdef7ac1605","repo":"micro/go-micro","slug":"mdns-error-sending-multicast-response-v","errorCode":null,"errorMessage":"mdns: error sending multicast response: %v","messagePattern":"mdns: error sending multicast response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/mdns/server.go","lineNumber":309,"sourceCode":"\t\t\t\t// 18.9: AD (Authentic Data) Bit\n\t\t\t\t// 18.10: CD (Checking Disabled) Bit\n\t\t\t\t// 18.11: RCODE (Response Code)\n\t\t\t},\n\t\t\t// 18.12 pertains to questions (handled by handleQuestion)\n\t\t\t// 18.13 pertains to resource records (handled by handleQuestion)\n\n\t\t\t// 18.14: Name Compression - responses should be compressed (though see\n\t\t\t// caveats in the RFC), so set the Compress bit (part of the dns library\n\t\t\t// API, not part of the DNS packet) to true.\n\t\t\tCompress: true,\n\t\t\tQuestion: query.Question,\n\t\t\tAnswer:   answer,\n\t\t}\n\t}\n\n\tif mresp := resp(false); mresp != nil {\n\t\tif err := s.sendResponse(mresp, from); err != nil {\n\t\t\treturn fmt.Errorf(\"mdns: error sending multicast response: %v\", err)\n\t\t}\n\t}\n\tif uresp := resp(true); uresp != nil {\n\t\tif err := s.sendResponse(uresp, from); err != nil {\n\t\t\treturn fmt.Errorf(\"mdns: error sending unicast response: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// handleQuestion is used to handle an incoming question\n//\n// The response to a question may be transmitted over multicast, unicast, or\n// both.  The return values are DNS records for each transmission type.\nfunc (s *Server) handleQuestion(q dns.Question) (multicastRecs, unicastRecs []dns.RR) {\n\trecords := s.config.Zone.Records(q)\n\tif len(records) == 0 {\n\t\treturn nil, nil","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/micro/go-micro/blob/24529f140421a11a33b6999ab7944f2021cfd69c/internal/util/mdns/server.go#L291-L327","documentation":"After resolving a query, handleQuery sends the multicast response via sendResponse. If that socket write fails, the underlying OS error is wrapped with this message. The unicast path has an analogous separate message.","triggerScenarios":"s.sendResponse(mresp, from) returning an error during parsePacket-driven query handling — e.g. the response socket was closed, interface went down, or destination is unreachable.","commonSituations":"Interface flapping mid-operation; network namespace/container teardown while server is live; buffer/queue exhaustion on the UDP socket (EAGAIN under load); server being shut down concurrently.","solutions":["Retry the mDNS exchange — the query source will typically re-query anyway","Check interface state and logs for socket closure around the time of failure","Ensure the server is not being stopped concurrently with query handling","Inspect the wrapped OS error (ECONNREFUSED, ENETUNREACH, EAGAIN) for the root cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := srv.handleQuery(query, from); err != nil {\n    if strings.Contains(err.Error(), \"error sending multicast response\") {\n        // transient send failure: safe to drop; querier will re-ask\n        log.Debugf(\"sendResponse failed (%v); ignoring\", err)\n        return nil\n    }\n    return err\n}","preventionTips":["Ensure the server outlives its sockets — avoid racing NewServer shutdown with packet handling","Monitor interface state; re-create the server after NIC changes","Don't alert on single send failures — mDNS retries are inherent to the protocol"],"tags":["network","mdns","udp","send-failure"],"backgroundTag":"udp-send-failure","analyzedSha":"24529f140421a11a33b6999ab7944f2021cfd69c","analyzedAt":"2026-09-01T02:52:24.923Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}