Skip to content

[Bug]: dispatch sendToAny swallows real send errors as success #24011

@XuPeng-SH

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

322041a

Other Environment Information

  • Hardware parameters:
  • OS type: Linux
  • Others:
    • repository: matrixorigin/matrixone
    • area: pkg/sql/colexec/dispatch

Actual Behavior

sendToAnyFunc() can swallow real send errors from sendToAnyLocalFunc() or sendToAnyRemoteFunc() by returning (false, nil) instead of propagating the error. That turns a failed dispatch into a success-shaped result, so upper layers can continue as if the batch had been sent successfully.

The risk is silent partial success / silent data loss rather than an explicit query failure.

Expected Behavior

When a local or remote sendToAny* helper returns a real error, sendToAnyFunc() should propagate that error to the caller immediately. Only the "all receivers of this kind are closed, fallback to the other kind" case should continue without error.

Steps to Reproduce

1. Use the current `main` code path in `pkg/sql/colexec/dispatch/sendfunc.go`.
2. Call `sendToAnyFunc()` in a state where it chooses the local branch.
3. Make `sendToAnyLocalFunc()` return `(false, someError)`.
4. Observe that `sendToAnyFunc()` returns `(false, nil)` instead of `someError`.
5. The same issue exists on the remote branch when `sendToAnyRemoteFunc()` returns a real error.

A minimal regression test can be written at the unit-test level by stubbing the local/remote helpers and asserting the error is preserved.

Additional information

Relevant code before the fix:

  • pkg/sql/colexec/dispatch/sendfunc.go:346-349
  • pkg/sql/colexec/dispatch/sendfunc.go:355-358

This area is particularly risky because sendToAny is the tolerant/failover path. It should tolerate exhausted receivers, but it should not mask genuine send failures such as network/write errors.

Metadata

Metadata

Assignees

Labels

kind/bugSomething isn't workingseverity/s0Extreme impact: Cause the application to break down and seriously affect the use

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions