[SERVER-16705] leak in PortMessageServer::acceptMP Created: 02/Jan/15  Updated: 15/Jan/15  Resolved: 06/Jan/15

Status: Closed
Project: Core Server
Component/s: Networking
Affects Version/s: 2.8.0-rc4
Fix Version/s: 2.8.0-rc5

Type: Bug Priority: Minor - P4
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-16761 Coverity analysis defect 49668: PW.US... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

When running the jsCore test suite with the clang Leak Sanitizer enabled, the following leak has been observed occasionally whenever buildscripts/smoke.py restarts the mongod server:

2014-12-30T18:56:33.961+0000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:35664 #4 (1 connection now open)
2014-12-30T18:56:33.961+0000 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2014-12-30T18:56:33.961+0000 I COMMAND  [signalProcessingThread] now exiting
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] closing listening socket: 7
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] closing listening socket: 8
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] closing listening socket: 12
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27999.sock
2014-12-30T18:56:33.961+0000 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2014-12-30T18:56:33.962+0000 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...
2014-12-30T18:56:33.962+0000 I STORAGE  [signalProcessingThread] shutdown: waiting for fs preallocator...
2014-12-30T18:56:33.962+0000 I STORAGE  [signalProcessingThread] shutdown: final commit...
2014-12-30T18:56:33.962+0000 I STORAGE  [signalProcessingThread] shutdown: closing all files...
2014-12-30T18:56:33.962+0000 I STORAGE  [signalProcessingThread] closeAllFiles() finished
2014-12-30T18:56:33.962+0000 I JOURNAL  [signalProcessingThread] journalCleanup...
2014-12-30T18:56:33.962+0000 I JOURNAL  [signalProcessingThread] removeJournalFiles
2014-12-30T18:56:33.962+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2014-12-30T18:56:33.962+0000 I COMMAND  [signalProcessingThread] dbexit:  rc: 0
2014-12-30T18:56:33.987+0000 I NETWORK  [initandlisten] Port 27999 is no longer valid
=================================================================
==3347==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x92cac9 in operator new(unsigned long) (/data/mci/shell/src/mongod+0x92cac9)
    #1 0x24f5184 in mongo::PortMessageServer::acceptedMP(mongo::MessagingPort*) /data/mci/shell/src/src/mongo/util/net/message_server_port.cpp:117
    #2 0x24e888b in mongo::Listener::accepted(boost::shared_ptr<mongo::Socket>, long long) /data/mci/shell/src/src/mongo/util/net/listen.cpp:575
    #3 0x24e62b4 in mongo::Listener::initAndListen() /data/mci/shell/src/src/mongo/util/net/listen.cpp:339
    #4 0x94d784 in mongo::_initAndListen(int) /data/mci/shell/src/src/mongo/db/db.cpp:619
    #5 0x94272b in mongo::initAndListen(int) /data/mci/shell/src/src/mongo/db/db.cpp:624
    #6 0x958fac in mongoDbMain(int, char**, char**) /data/mci/shell/src/src/mongo/db/db.cpp:870
    #7 0x958fac in main /data/mci/shell/src/src/mongo/db/db.cpp:673
    #8 0x7f5fdee9dec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
-----------------------------------------------------
Suppressions used:
  count      bytes template
      7       8688 mongo::Client::Client
-----------------------------------------------------
SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).

Here's the line with the leak:

https://github.com/mongodb/mongo/blob/af8fdf9102f60fc731ef64c8ad5cb2b19745dc4e/src/mongo/util/net/message_server_port.cpp#L117

                HandleIncomingMsgParam* himParam = new HandleIncomingMsgParam(p, _handler);



 Comments   
Comment by Githook User [ 06/Jan/15 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-16705 fixed leak in PortMessageServer::acceptedMP

This leak occurs when the server is shutdown before the connection handling thread starts.
Branch: master
https://github.com/mongodb/mongo/commit/9804789bbba304cb0649d7874ef0bb390f536b46

Generated at Thu Feb 08 03:41:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.