[GODRIVER-951] golang connection consume huge memory, maybe memory leak Created: 10/Apr/19 Updated: 27/Oct/23 Resolved: 26/Apr/19 |
|
| Status: | Closed |
| Project: | Go Driver |
| Component/s: | Connections |
| Affects Version/s: | 1.0.0-rc2 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | generalking | Assignee: | Kristofer Brandow (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
linux |
||
| Attachments: |
|
| Description |
|
when use mongo driver to connect several port parallel, the connect method use a lot of memory, sample code:
** the memory use like this 26.29GB 96.86% 96.86% 26.29GB 96.86% /go.mongodb.org/mongo-driver/x/network/connection.(*connection).ReadWireMessage |
| Comments |
| Comment by David Bartley [ 19/Jun/19 ] | ||||||||||
| Comment by David Bartley [ 19/Jun/19 ] | ||||||||||
|
I dug around some more, and I think the original user's issue was triggered by, arguably, a bug in connction.ReadWireMessage. Specifically, that does:
If you were to point the go driver at an HTTP server, it'd get back "HTTP" as the first 4 byes, a rather large 32-bit number when converted. You can even see in one of the attachments that go allocated a 1+ GiB block. That said, I'm not seeing large blocks, only 16 MiB blocks, so I'll file a new ticket. | ||||||||||
| Comment by David Bartley [ 19/Jun/19 ] | ||||||||||
|
We're also seeing this, though we're not doing anything particular odd like connecting to non-mongo ports. We just have a long-running process that tails the oplog. It's possible that the issue is tied to having a long-running cursor? | ||||||||||
| Comment by Kristofer Brandow (Inactive) [ 26/Apr/19 ] | ||||||||||
|
generalking, this is not a supported use case for the MongoDB Go driver. | ||||||||||
| Comment by generalking [ 23/Apr/19 ] | ||||||||||
|
I want to check whether a port is MongoDB or not. | ||||||||||
| Comment by Kristofer Brandow (Inactive) [ 22/Apr/19 ] | ||||||||||
|
generalking If I understand your last comment correctly, you're using the MongoDB Go driver to connect to sshd and nginx. Can you elaborate on why you are doing this? | ||||||||||
| Comment by generalking [ 22/Apr/19 ] | ||||||||||
|
No, I don't use benchmark suite in my test program. I just use the mongo driver to connect several ports, which are listened by sshd, nginx, python etc. | ||||||||||
| Comment by Kristofer Brandow (Inactive) [ 19/Apr/19 ] | ||||||||||
|
generalking, are you using the benchmark suite in the testing package? I can't reproduce your results. This is what top10 looks like for me:
| ||||||||||
| Comment by generalking [ 19/Apr/19 ] | ||||||||||
|
| ||||||||||
| Comment by generalking [ 19/Apr/19 ] | ||||||||||
|
| ||||||||||
| Comment by generalking [ 19/Apr/19 ] | ||||||||||
|
In my test program, i add this code
then, i run my test program | ||||||||||
| Comment by Kristofer Brandow (Inactive) [ 15/Apr/19 ] | ||||||||||
|
generalking, Can you please provide more information about how your obtained that pprof output? |