Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix the data race of ackReq.err #881

Merged
merged 1 commit into from
Nov 29, 2022
Merged

Conversation

Gleiphir2769
Copy link
Contributor

Master Issue: #879

Motivation

#879 shows ackReq.err has data race problem.

Read

return ackReq.err
}

Write

err := pc.client.rpcClient.RequestOnCnxNoWait(pc._getConn(), pb.BaseCommand_ACK, cmdAck)
if err != nil {
pc.log.Error("Connection was closed when request ack cmd")
req.err = err
}
}

After ackReq.doneCh has introduced in #777 , I think the final return value of AckId can be nil. Because ackReq.err may not necessarily be set before the AckID returns. If user need to know the result of ack, just using AckIDWithResponse will be fine.

Modifications

Modify the return value of AckID.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

@Gleiphir2769
Copy link
Contributor Author

/pulsarbot run-failure-checks

1 similar comment
@Gleiphir2769
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Gleiphir2769
Copy link
Contributor Author

/pulsarbot run-failure-checks

@nodece
Copy link
Member

nodece commented Nov 4, 2022

@Gleiphir2769 I think we should return this error, do you have any other way to fix this?

@Gleiphir2769
Copy link
Contributor Author

@Gleiphir2769 I think we should return this error, do you have any other way to fix this?

@nodece Hi, thanks for your opinion. I think this error doesn't matter.

This error is set in another goroutine internalAck. When AckId returns, internalAck is not necessarily executing. It means that if internalAck really fails, the ackReq.err returned by AckId may still be nil instead of actual err.

After #777 , AckId has been specified as an async method. AckIDWithResponse should be called If user really need to know the ack result,.

@nodece nodece requested a review from wolfstudy November 4, 2022 15:26
@Gleiphir2769
Copy link
Contributor Author

@wolfstudy Hi, could you give a review when you r free?

@nodece nodece requested a review from merlimat November 22, 2022 04:12
@nodece nodece merged commit 0b197f7 into apache:master Nov 29, 2022
@RobertIndie RobertIndie added this to the v0.10.0 milestone Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants