{"record":{"id":"a52d6b598f97dd8b","repo":"vitessio/vitess","slug":"failed-to-send-the-combinlogdump-command-v","errorCode":null,"errorMessage":"failed to send the ComBinlogDump command: %v","messagePattern":"failed to send the ComBinlogDump command: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/binlog/binlog_connection.go","lineNumber":225,"sourceCode":"//\n// The stream will continue in the background, waiting for new events if\n// necessary, until the connection is closed, either by the source or\n// by canceling the context.\n//\n// Note the context is valid and used until eventChan is closed.\nfunc (bc *BinlogConnection) StartBinlogDumpFromBinlogBeforeTimestamp(ctx context.Context, timestamp int64) (<-chan mysql.BinlogEvent, <-chan error, error) {\n\tctx, bc.cancel = context.WithCancel(ctx)\n\n\tfilename, err := bc.findFileBeforeTimestamp(ctx, timestamp)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Start dumping the logs. The position is '4' to skip the\n\t// Binlog File Header. See this page for more info:\n\t// https://dev.mysql.com/doc/internals/en/binlog-file.html\n\tif err := bc.WriteComBinlogDump(bc.serverID, filename, 4, 0); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to send the ComBinlogDump command: %v\", err)\n\t}\n\te, c := bc.streamEvents(ctx)\n\treturn e, c, nil\n}\n\nfunc (bc *BinlogConnection) findFileBeforeTimestamp(ctx context.Context, timestamp int64) (filename string, err error) {\n\t// List the binlogs.\n\tbinlogs, err := bc.ExecuteFetch(\"SHOW BINARY LOGS\", 1000, false)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to SHOW BINARY LOGS: %v\", err)\n\t}\n\n\t// Start with the most recent binlog file until we find the right event.\n\tfor _, row := range slices.Backward(binlogs.Rows) {\n\t\t// Exit the loop early if context is canceled.\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn \"\", ctx.Err()","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/binlog/binlog_connection.go#L207-L243","documentation":"StartBinlogDumpFromBinlogBeforeTimestamp writes the raw ComBinlogDump command to the MySQL server after locating the right binlog file (position 4, skipping the file header). If writing that command fails on the socket, the dump cannot start and this error is returned. It means the replication dump request never reached (or was rejected by) the server.","triggerScenarios":"Calling StartBinlogDumpFromBinlogBeforeTimestamp when bc.WriteComBinlogDump returns an error — broken/dead connection, write timeout, or server closed the socket before the command was sent.","commonSituations":"Long findFileBeforeTimestamp scan let the connection time out before the dump command; firewall/NAT dropped the idle replication socket; MySQL server killed the connection (wait_timeout); network partition during a reshard/backup stream.","solutions":["Re-establish the binlog connection (NewBinlogConnection) and retry the timestamp-based dump; treat it as transient if the socket was closed.","Increase MySQL wait_timeout / net_write_timeout and proxy idle timeouts for long-running replication connections.","Check network gear between Vitess and MySQL for aggressive idle-connection teardown.","Inspect MySQL error log for Aborted clients or connection kills around the failure time."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: ensure the connection is alive right before the dump\nif err := bc.Ping(); err != nil {\n\treturn fmt.Errorf(\"binlog connection dead before dump: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"e, c, err := bc.StartBinlogDumpFromBinlogBeforeTimestamp(ctx, ts)\nif err != nil && strings.Contains(err.Error(), \"failed to send the ComBinlogDump command\") {\n\t// re-dial via NewBinlogConnection and retry with backoff\n}","preventionTips":["Raise MySQL wait_timeout/net_write_timeout for replication connections.","Configure proxies/firewalls to keep long-lived replication TCP flows idle-safe.","Keep timestamp-based catchup windows small so file scans stay short.","Monitor for Aborted_connects / Aborted_clients on the primary."],"tags":["mysql","replication","binlog","network"],"backgroundTag":"binlog-dump-command-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}