[GODRIVER-693] Opening a change stream cursor for any database gives error Created: 13/Dec/18  Updated: 28/Oct/23  Resolved: 20/Dec/18

Status: Closed
Project: Go Driver
Component/s: CRUD
Affects Version/s: None
Fix Version/s: 0.2.0

Type: Bug Priority: Critical - P2
Reporter: Shivam Rathore Assignee: Go Community User
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 18.04.1 LTS
go version go1.11.2 linux/amd64



 Description   

On opening a change stream cursor for any database, whenever the cursor is used to decode, it panics on runtime.

Generate the case using: this

Output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x779242]

goroutine 1 [running]:
github.com/mongodb/mongo-go-driver/mongo.(*changeStream).Decode(0xc000118000, 0x7bb880, 0xc000116028, 0xc0000cfe01, 0x42ad92)
$GOPATH/src/github.com/mongodb/mongo-go-driver/mongo/change_stream.go:454 +0x62
main.traverseCursor(0x979100, 0xc00001e0f0, 0x97a0c0, 0xc000118000)
.../main.go:27 +0x48
main.watchOnDB(0x979100, 0xc00001e0f0, 0xc000093400, 0x84e5bc, 0x6)
.../main.go:68 +0x1dc
main.main()
.../main.go:81 +0x119

Process finished with exit code 2

I have resolved the bug and created a PR on Github: #117

 



 Comments   
Comment by Githook User [ 20/Dec/18 ]

Author:

{'username': 'skriptble', 'email': 'kris@mongodb.com', 'name': 'Kris Brandow'}

Message: Merge branch 'pr/117'

GODRIVER-693

Change-Id: Ie264f72af8712c8bedddb997f31e3cd90e037e27
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/7e0a364ea9695e4eb86541e08572b85258435332

Generated at Thu Feb 08 08:34:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.