Lokesh_D1
(Lokesh D)
March 21, 2023, 6:28pm
#1
Hi Team,
We are facing below error…
Can any one please explain regarding below error and how can we resolve it?
2023-02-17T13:49:05.811Z d3a68076-d393-4203-9248-a1e3cd1e9584 INFO MongoNetworkError: getaddrinfo EMFILE mongodb-atlas-shard-00-01.example.mongodb.net
at connectionFailureError (/var/task/file-info/file-info-controller.js:90731:18)
at TLSSocket.<anonymous> (/var/task/file-info/file-info-controller.js:90656:20)
at Object.onceWrapper (events.js:520:26)
at TLSSocket.emit (events.js:400:28)
at TLSSocket.emit (domain.js:475:12)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
cause: Error: getaddrinfo EMFILE mongodb-atlas-shard-00-01.example.mongodb.net
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26) {
errno: -24,
code: 'EMFILE',
syscall: 'getaddrinfo',
hostname: 'mongodb-atlas-shard-00-01.example.mongodb.net'
},
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
}
Can please help me on this error…
We are getting same error frequently, Is this related to MongoDB or any other?
Thanks in advance…
Lokesh_D1
(Lokesh D)
March 21, 2023, 6:42pm
#2
Lokesh_D1:
2023-02-17T13:49:05.811Z d3a68076-d393-4203-9248-a1e3cd1e9584 INFO MongoNetworkError: getaddrinfo EMFILE mongodb-atlas-shard-00-01.example.mongodb.net
at connectionFailureError (/var/task/file-info/file-info-controller.js:90731:18)
at TLSSocket.<anonymous> (/var/task/file-info/file-info-controller.js:90656:20)
at Object.onceWrapper (events.js:520:26)
at TLSSocket.emit (events.js:400:28)
at TLSSocket.emit (domain.js:475:12)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
cause: Error: getaddrinfo EMFILE mongodb-atlas-shard-00-01.klzrb.mongodb.net
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26) {
errno: -24,
code: 'EMFILE',
syscall: 'getaddrinfo',
hostname: 'mongodb-atlas-shard-00-01.example.mongodb.net'
},
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
}
and also getting {"connectionGeneration":0}
error also…
steevej
(Steeve Juneau)
March 22, 2023, 12:35pm
#4
It looks like your code keeps opening new connections without closing the previous one.
EMFILE error means that the OS denied your application from opening new connection because it is using too many.
Lokesh_D1
(Lokesh D)
March 24, 2023, 3:48am
#5
Thanks @steevej for response,
Code closes the connections immediately without any ideal connections… But concurrent hits gone be high at the time.
How can we handle too many hits in per second? (More then 30k to 40k hits per second)
We are using atlas M400 (SSD class) tier. It has max 1,28,000 connections. Is it reached?
Is there any better way to handle the connections?
Is this error related to MongoDB or Node.js server ?
steevej
(Steeve Juneau)
March 24, 2023, 2:11pm
#6
Not a MongoDB or Node.js issue. It is a code issue. It is a limit of your OS.
Are you opening a connection for each and every
then
Do not open a connections for each hit.
Brock
(Brock)
March 24, 2023, 4:52pm
#7
@Lokesh_D1 You need to open a support ticket with the Technical Services Team.
This error will need MongoDB Engineering to analyze and is Atlas side by the looks of it.
You can try subscribing to the free trial for MongoDB Support via Atlas Developer Tier and submitting a ticket. The technical services rep will open an internal ticket and have engineering look deeper into it.
Lokesh_D1
(Lokesh D)
March 25, 2023, 7:54am
#8