[GODRIVER-1298] Panic in topology/pool.go:416 Created: 04/Sep/19  Updated: 28/Oct/23  Resolved: 12/Sep/19

Status: Closed
Project: Go Driver
Component/s: Core API
Affects Version/s: None
Fix Version/s: 1.1.2

Type: Bug Priority: Major - P3
Reporter: Bradley Wilson-Hunt Assignee: Isabella Siu (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File image-2019-09-05-16-23-39-008.png    
Issue Links:
Depends
is depended on by GODRIVER-1297 Opening new connections takes a long ... Closed
Case:

 Description   

During some investigation on another issue we were testing the current master branch (22646d953d8106e567b1da9aab98b627a2fb204f) with some of our loadtests and we receive panics from here:

https://github.com/mongodb/mongo-go-driver/blob/master/x/mongo/driver/topology/pool.go#L416

 

{"app":"matchmaking-api","env":"test","error":"connection() : auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": context canceled","game":"","message":"could not return all matchmakings for filter [map[game:pubg region:EU] map[game:csgo region:EU]]","severity":"ERROR","showAllGames":false,"timestamp":{"seconds":1567596173,"nanos":165825408},"userID":"admin","version":"SNAPSHOT"}{"app":"matchmaking-api","env":"test","error":"connection() : auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": context canceled","game":"","message":"could not return all matchmakings for filter [map[game:pubg region:EU] map[game:csgo region:EU]]","severity":"ERROR","showAllGames":false,"timestamp":{"seconds":1567596173,"nanos":165825408},"userID":"admin","version":"SNAPSHOT"}panic: runtime error: invalid memory address or nil pointer dereference[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb4b970] goroutine 2848 [running]:go.mongodb.org/mongo-driver/x/mongo/driver/topology.(*pool).closeConnection(0xc0000c5080, 0xc0008fd600, 0x0, 0x0) /home/bwilsonhunt/go/pkg/mod/go.mongodb.org/mongo-driver@v1.1.1-0.20190903130008-22646d953d81/x/mongo/driver/topology/pool.go:416 +0xb0go.mongodb.org/mongo-driver/x/mongo/driver/topology.connectionCloseFunc.func1(0xc0008fd600) /home/bwilsonhunt/go/pkg/mod/go.mongodb.org/mongo-driver@v1.1.1-0.20190903130008-22646d953d81/x/mongo/driver/topology/pool.go:119 +0x37created by go.mongodb.org/mongo-driver/x/mongo/driver/topology.connectionCloseFunc /home/bwilsonhunt/go/pkg/mod/go.mongodb.org/mongo-driver@v1.1.1-0.20190903130008-22646d953d81/x/mongo/driver/topology/pool.go:119 +0x61

It happens consistently accross all the pods.

 

This is the mongo connection string used:

```

mongodb://xx:xxxx@xxx:27017,xxx:27017,xxxx:27017/matchmaking-service?ssl=true&authSource=admin&maxPoolSize=100&minPoolSize=10

```

 



 Comments   
Comment by Bradley Wilson-Hunt [ 16/Sep/19 ]

I can confirm pulling from master that this fix is working!

Thanks!

Comment by Githook User [ 12/Sep/19 ]

Author:

{'username': 'iwysiu', 'email': 'isabella.siu@10gen.com', 'name': 'iwysiu'}

Message: GODRIVER-1298 fix panic from closing disconnected connection

Change-Id: I3ae9b0aca1c40c4a1ee3a672b249fabc4ec8b3ad
Branch: release/1.1
https://github.com/mongodb/mongo-go-driver/commit/b89d991fcaf79bcea8218a5e9b387bc64d50500a

Comment by Githook User [ 12/Sep/19 ]

Author:

{'name': 'iwysiu', 'username': 'iwysiu', 'email': 'isabella.siu@10gen.com'}

Message: GODRIVER-1298 fix panic from closing disconnected connection

Change-Id: I3ae9b0aca1c40c4a1ee3a672b249fabc4ec8b3ad
Branch: master
https://github.com/mongodb/mongo-go-driver/commit/e8c2926d73bdb525c0620eeed7d12f368eaa74aa

Comment by Isabella Siu (Inactive) [ 06/Sep/19 ]

code review url: https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/467710

Comment by Bradley Wilson-Hunt [ 05/Sep/19 ]

Im also able to reproduce this same issue in the latest release/1.1 branch (4028be8728b2b5ab8b02c9c5660eff657280f0a3)

 

If minPoolSize is removed from the uri i can't replicate the issue. However when minPoolSize is removed the application can't handle that many RPS and ends up with even more ctx cancelled.

Comment by Bradley Wilson-Hunt [ 04/Sep/19 ]

I appologize for the formatting but it does not seem like i can edit the issue after its been created..

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