[GODRIVER-2489] Return error if createPipelineOptionsDoc failed in executeOperation Created: 12/Jul/22 Updated: 28/Oct/23 Resolved: 20/Oct/22 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Aggregation, Change Streams |
| Affects Version/s: | 1.6.0, 1.9.1 |
| Fix Version/s: | 1.10.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | peng zhenyi | Assignee: | Preston Vasquez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
SummaryChangeStream::createPipelineOptionsDoc() may return nil and set cs.err if failed. But the caller ChangeStream::executeOperation() does not handle cs.err != nil condition or nil return. This may lead to broken $changeStream BSON command, and then get an error from mongo server : "invalid bson type in element with field name 'rsor' in object with unknown _id " My develop environment is go-driver v1.6.0, and I comfirmed this bug in v1.9.1 and master. My MongoDB server version is MongoDB 4.0 How to Reproduce
Additional BackgroundChangeStream::createPipelineOptionsDoc() error is already handled in ChangeStream::buildPipelineSlice(), see: https://github.com/mongodb/mongo-go-driver/blob/v1.9.1/mongo/change_stream.go#L366-L369 But ChangeStream::executeOperation() don't, see: https://github.com/mongodb/mongo-go-driver/blob/v1.9.1/mongo/change_stream.go#L249 |
| Comments |
| Comment by Githook User [ 02/Aug/22 ] |
|
Author: {'name': 'Preston Vasquez', 'email': 'prestonvasquez@icloud.com', 'username': 'prestonvasquez'}Message: |
| Comment by Githook User [ 01/Aug/22 ] |
|
Author: {'name': 'Preston Vasquez', 'email': 'prestonvasquez@icloud.com', 'username': 'prestonvasquez'}Message: Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> |
| Comment by Esha Bhargava [ 15/Jul/22 ] |
|
pengzhenyi Thank you for reporting this issue. We'll look into it and get back to you. |
| Comment by peng zhenyi [ 12/Jul/22 ] |
|
The error should be handled in go-driver. So I create a PullRequest: https://github.com/mongodb/mongo-go-driver/pull/1020 |