Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

err Error: connect EMFILE #56

Open
zhuermu opened this issue Nov 25, 2024 · 4 comments
Open

err Error: connect EMFILE #56

zhuermu opened this issue Nov 25, 2024 · 4 comments

Comments

@zhuermu
Copy link

zhuermu commented Nov 25, 2024

when I use the connector to two days after, the web server error: "
err Error: connect EMFILE 127.0.0.1:5432 - Local (undefined:undefined)
at /app/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PGClient.query (/app/server/util/postgres.js:39:24)
at async PGClient.list (/app/server/util/postgres.js:136:26)
at async Object.loadData (/app/server/util/cache.js:30:26) {
errno: -24,
code: 'EMFILE',
syscall: 'connect',
address: '127.0.0.1',
port: 5432"

I think maybe this problem is the db connect not use pool or maybe it's not properly closing the connection?

@BlastShadowsong
Copy link

I also encountered this problem, which can cause the docker container to become "unhealthy" after running for about a day, leading to the service becoming unavailable.

@yancl
Copy link

yancl commented Dec 7, 2024

I think the problem is log file descriptor leak, it will create two new fd every time loggerHandler called and never released.

  • number of log file descriptors in the nodejs process.(314452):
lsof -p 314452 | grep 'combined.log' | wc -l
961
  • after temp fix:
lsof -p 340793 | grep 'combined.log' | wc -l
1

@wengkaer will you please have a look?

@cloudbeer
Copy link
Contributor

When using winston, I incorrectly called the createLogger method in the middleware, causing a file handle leak.

This error will be fixed in 0.0.19.

@cloudbeer
Copy link
Contributor

I think the problem is log file descriptor leak, it will create two new fd every time loggerHandler called and never released.

  • number of log file descriptors in the nodejs process.(314452):
lsof -p 314452 | grep 'combined.log' | wc -l
961
  • after temp fix:
lsof -p 340793 | grep 'combined.log' | wc -l
1

@wengkaer will you please have a look?

Thank you for pointing out the error you described. This error will be fixed in the next version 0.0.19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants