diff --git a/socket-connection-monitoring.logs.txt b/socket-connection-monitoring.logs.txt deleted file mode 100644 index 9cd5a20717..0000000000 --- a/socket-connection-monitoring.logs.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{} -{"relevantHostAddresses":[{"host":"localhost","port":31000},{"host":"localhost","port":31000}]} -{} -{"relevantHostAddresses":[{"host":"localhost","port":31001}]} -{} -{"relevantHostAddresses":[{"host":"localhost","port":31002}]} -{} -{"relevantHostAddresses":[{"host":"localhost","port":31003}]} -{"beforeExitHappened":true} -{"error":{"message":"Converting circular structure to JSON\n --> starting at object with constructor 'MongoClient'\n | property 's' -> object with constructor 'Object'\n | property 'sessionPool' -> object with constructor 'ServerSessionPool'\n --- property 'client' closes the circle","stack":"TypeError: Converting circular structure to JSON\n --> starting at object with constructor 'MongoClient'\n | property 's' -> object with constructor 'Object'\n | property 'sessionPool' -> object with constructor 'ServerSessionPool'\n --- property 'client' closes the circle\n at JSON.stringify ()\n at log (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:112:29)\n at run (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:20:37)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async main (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:121:3)","resources":{"libuvResources":[{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x000000012981e920","localEndpoint":{"host":"localhost","port":64049},"remoteEndpoint":{"host":"localhost","port":31000},"sendBufferSize":146808,"recvBufferSize":406960,"fd":24,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000129820140","localEndpoint":{"host":"localhost","port":64050},"remoteEndpoint":{"host":"localhost","port":31001},"sendBufferSize":146808,"recvBufferSize":406984,"fd":25,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000129820550","localEndpoint":{"host":"localhost","port":64051},"remoteEndpoint":{"host":"localhost","port":31002},"sendBufferSize":146808,"recvBufferSize":406984,"fd":26,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000129820a20","localEndpoint":{"host":"localhost","port":64052},"remoteEndpoint":{"host":"localhost","port":31003},"sendBufferSize":146808,"recvBufferSize":407095,"fd":27,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000129820ef0","localEndpoint":{"host":"localhost","port":64053},"remoteEndpoint":{"host":"localhost","port":31000},"sendBufferSize":146808,"recvBufferSize":406294,"fd":28,"writeQueueSize":0,"readable":true,"writable":true}],"activeResources":["TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","Timeout","Timeout","Timeout","Timeout"]}}} -{"error":{"message":"Converting circular structure to JSON\n --> starting at object with constructor 'MongoClient'\n | property 's' -> object with constructor 'Object'\n | property 'sessionPool' -> object with constructor 'ServerSessionPool'\n --- property 'client' closes the circle","stack":"TypeError: Converting circular structure to JSON\n --> starting at object with constructor 'MongoClient'\n | property 's' -> object with constructor 'Object'\n | property 'sessionPool' -> object with constructor 'ServerSessionPool'\n --- property 'client' closes the circle\n at JSON.stringify ()\n at log (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:112:29)\n at run (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:20:37)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async main (/Users/aditi.khare/Desktop/node-mongodb-native/socket-connection-monitoring.cjs:121:3)","resources":{"libuvResources":[{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000106e1bb10","localEndpoint":{"host":"localhost","port":64068},"remoteEndpoint":{"host":"localhost","port":31000},"sendBufferSize":146808,"recvBufferSize":406960,"fd":24,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000106e1fd30","localEndpoint":{"host":"localhost","port":64069},"remoteEndpoint":{"host":"localhost","port":31001},"sendBufferSize":146808,"recvBufferSize":406984,"fd":27,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000106e20070","localEndpoint":{"host":"localhost","port":64070},"remoteEndpoint":{"host":"localhost","port":31002},"sendBufferSize":146808,"recvBufferSize":406984,"fd":28,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000106e20540","localEndpoint":{"host":"localhost","port":64071},"remoteEndpoint":{"host":"localhost","port":31003},"sendBufferSize":146808,"recvBufferSize":407095,"fd":26,"writeQueueSize":0,"readable":true,"writable":true},{"type":"tcp","is_active":true,"is_referenced":true,"address":"0x0000000106e20a10","localEndpoint":{"host":"localhost","port":64072},"remoteEndpoint":{"host":"localhost","port":31000},"sendBufferSize":146808,"recvBufferSize":406294,"fd":25,"writeQueueSize":0,"readable":true,"writable":true}],"activeResources":["TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","TCPSocketWrap","Timeout","Timeout","Timeout","Timeout"]}}} -{"server":"[\n 'localhost:31000',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31000',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31000},{"host":"localhost","port":31000}]} -{"server":"[\n 'localhost:31001',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31001',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31001}]} -{"server":"[\n 'localhost:31002',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31002',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31002}]} -{"server":"[\n 'localhost:31003',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'paused',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31003',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31003}]} -{"beforeExitHappened":true} -{"server":"[\n 'localhost:31000',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31000',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31000},{"host":"localhost","port":31000}]} -{"server":"[\n 'localhost:31001',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31001',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31001}]} -{"server":"[\n 'localhost:31002',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'ready',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31002',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31002}]} -{"server":"[\n 'localhost:31003',\n Server {\n _events: [Object: null prototype] {\n serverHeartbeatStarted: [Function (anonymous)],\n serverHeartbeatSucceeded: [Function (anonymous)],\n serverHeartbeatFailed: [Function (anonymous)],\n commandStarted: [Function (anonymous)],\n commandSucceeded: [Function (anonymous)],\n commandFailed: [Function (anonymous)],\n connectionPoolCreated: [Function (anonymous)],\n connectionPoolReady: [Function (anonymous)],\n connectionPoolCleared: [Function (anonymous)],\n connectionPoolClosed: [Function (anonymous)],\n connectionCreated: [Function (anonymous)],\n connectionReady: [Function (anonymous)],\n connectionClosed: [Function (anonymous)],\n connectionCheckOutStarted: [Function (anonymous)],\n connectionCheckOutFailed: [Function (anonymous)],\n connectionCheckedOut: [Function (anonymous)],\n connectionCheckedIn: [Function (anonymous)],\n descriptionReceived: [Function (anonymous)]\n },\n _eventsCount: 18,\n _maxListeners: undefined,\n serverApi: undefined,\n topology: Topology {\n _events: [Object: null prototype],\n _eventsCount: 26,\n _maxListeners: undefined,\n client: [MongoClient],\n waitQueue: [List],\n s: [Object],\n mongoLogger: undefined,\n component: 'topology',\n connectionLock: undefined,\n [Symbol(kCapture)]: false\n },\n pool: ConnectionPool {\n _events: [Object: null prototype],\n _eventsCount: 15,\n _maxListeners: undefined,\n options: [Object],\n poolState: 'paused',\n server: [Circular *1],\n connections: [List],\n pending: 0,\n checkedOut: Set(0) {},\n minPoolSizeTimer: undefined,\n generation: 0,\n serviceGenerations: Map(0) {},\n connectionCounter: Object [Generator] {},\n cancellationToken: [CancellationToken],\n waitQueue: [List],\n metrics: [ConnectionPoolMetrics],\n processingWaitQueue: false,\n mongoLogger: undefined,\n component: 'connection',\n [Symbol(kCapture)]: false\n },\n s: {\n description: [ServerDescription],\n options: [Object: null prototype],\n state: 'connected',\n operationCount: 0\n },\n monitor: Monitor {\n _events: [Object: null prototype],\n _eventsCount: 4,\n _maxListeners: undefined,\n component: 'topology',\n server: [Circular *1],\n connection: [Connection],\n cancellationToken: [CancellationToken],\n monitorId: [MonitorInterval],\n s: [Object],\n address: 'localhost:31003',\n options: [Object],\n isRunningInFaasEnv: false,\n mongoLogger: undefined,\n rttSampler: [RTTSampler],\n connectOptions: [Object],\n [Symbol(kCapture)]: false\n },\n [Symbol(kCapture)]: false\n }\n]"} -{"relevantHostAddresses":[{"host":"localhost","port":31003}]} -{"beforeExitHappened":true} diff --git a/test/integration/node-specific/client_close.test.ts b/test/integration/node-specific/client_close.test.ts index f67043c9cb..d4784e6e38 100644 --- a/test/integration/node-specific/client_close.test.ts +++ b/test/integration/node-specific/client_close.test.ts @@ -4,7 +4,7 @@ import { MongoClient } from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; import { runScriptAndGetProcessInfo } from './resource_tracking_script_builder'; -describe('MongoClient.close() Integration', () => { +describe.only('MongoClient.close() Integration', () => { // note: these tests are set-up in accordance of the resource ownership tree let config: TestConfiguration; @@ -104,8 +104,8 @@ describe('MongoClient.close() Integration', () => { describe('Connection Monitoring', () => { describe('Node.js resource: Socket', () => { - it.only('no sockets remain after client.close()', metadata, async function () { - const run = async function({ MongoClient, uri, log, expect }) { + it('no sockets remain after client.close()', metadata, async function () { + const run = async function({ MongoClient, uri, expect }) { const client = new MongoClient(uri); await client.connect(); @@ -117,17 +117,10 @@ describe('MongoClient.close() Integration', () => { .map(r => r.remoteEndpoint); // assert socket creation - // there should be two sockets for each server: - // client connection socket - // monitor socket - log(connectionMonitoringReport()); const servers = client.topology?.s.servers; for (const server of servers) { const { host, port } = server[1].s.description.hostAddress; - log('MONITOR OF ', host, port, ':\n', server[1].monitor.address); - const relevantHostAddresses = connectionMonitoringReport().filter(r => r.host === host && r.port === port); - //log({ relevantHostAddresses }); - // expect(relevantHostAddresses).length.to.be.gte(2); + expect(connectionMonitoringReport()).to.deep.include({host, port}); } await client.close(); @@ -138,13 +131,11 @@ describe('MongoClient.close() Integration', () => { expect(connectionMonitoringReport()).to.not.deep.include({ host, port }); } }; - /* await runScriptAndGetProcessInfo( + await runScriptAndGetProcessInfo( 'socket-connection-monitoring', config, run - ); */ - - await run({ MongoClient, uri: config.uri, log: console.log, expect }); + ); }); }); }); @@ -162,7 +153,7 @@ describe('MongoClient.close() Integration', () => { describe('Node.js resource: Socket', () => { describe('when rtt monitoring is turned on', () => { it('no sockets remain after client.close()', async () => { - const run = async function ({ MongoClient, uri, expect, sleep }) { + const run = async ({ MongoClient, uri, expect, sleep }) => { const heartbeatFrequencyMS = 100; const client = new MongoClient(uri, { serverMonitoringMode: 'stream', @@ -214,7 +205,7 @@ describe('MongoClient.close() Integration', () => { expect(newSocketsAfterClose).to.have.length(0); }; - await runScriptAndGetProcessInfo('socket-connection-monitoring', config, run); + await runScriptAndGetProcessInfo('socket-connection-rtt-monitoring', config, run); }); }); }); diff --git a/test/integration/node-specific/resource_tracking_script_builder.ts b/test/integration/node-specific/resource_tracking_script_builder.ts index a8ea733183..5d0a4ebc43 100644 --- a/test/integration/node-specific/resource_tracking_script_builder.ts +++ b/test/integration/node-specific/resource_tracking_script_builder.ts @@ -8,6 +8,7 @@ import { parseSnapshot } from 'v8-heapsnapshot'; import { type BSON, type ClientEncryption, type MongoClient } from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; +import { sleep } from '../../tools/utils'; export type ResourceTestFunction = HeapResourceTestFunction | ProcessResourceTestFunction; @@ -24,7 +25,7 @@ export type ProcessResourceTestFunction = (options: { expect: typeof expect; ClientEncryption?: typeof ClientEncryption; BSON?: typeof BSON; - sleep?: typeof Promise; + sleep?: typeof sleep; }) => Promise; const HEAP_RESOURCE_SCRIPT_PATH = path.resolve( @@ -185,12 +186,12 @@ export async function runScriptAndGetProcessInfo( // delete temporary files await unlink(scriptName); - // await unlink(logFile); + await unlink(logFile); // assertions about exit status if (exitCode) { const assertionError = new AssertionError( - messages.error.message + '\n\t' + JSON.stringify(messages.error.resources) + messages.error.message + '\n\t' + JSON.stringify(messages.error.resources, undefined, 2) ); assertionError.stack = messages.error.stack + new Error().stack.slice('Error'.length); throw assertionError; @@ -198,5 +199,5 @@ export async function runScriptAndGetProcessInfo( // assertions about resource status expect(messages.beforeExitHappened).to.be.true; - expect(messages.newLibuvResources).to.be.empty; + expect(messages.newResources).to.be.empty; } diff --git a/test/tools/fixtures/process_resource_script.in.js b/test/tools/fixtures/process_resource_script.in.js index 845afc5d9b..ebf3dd6f86 100644 --- a/test/tools/fixtures/process_resource_script.in.js +++ b/test/tools/fixtures/process_resource_script.in.js @@ -17,6 +17,7 @@ const { setTimeout } = require('timers'); let originalReport; const logFile = scriptName + '.logs.txt'; +const sleep = promisify(setTimeout); const run = func; @@ -92,7 +93,8 @@ async function main() { process.on('beforeExit', () => { log({ beforeExitHappened: true }); }); - await run({ MongoClient, uri, log, expect, ClientEncryption, BSON }); + await run({ MongoClient, uri, log, expect, ClientEncryption, BSON, sleep }); + log({ newResources: getNewResources() }); } main()