I am running a node scheduler using agenda. It runs fine for around 30 minutes and then it starts displaying this error.
{ [Error: EMFILE, open 'log/scheduler.log'] errno: 20, code: 'EMFILE', path: 'log/scheduler.log' }
{ [Error: EMFILE, open 'log/scheduler.log'] errno: 20, code: 'EMFILE', path: 'log/scheduler.log' }
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
[Error: failed to connect to [localhost:27017]]
I am using node js with mongo db deployed on a EC2 instance.
The code I wrote is here:
https://github.com/kelvinblade/bluesky-scheduler2
Any help would be appreciated.
EMFILE occurs when too many file descriptors are open as there is limitation in an os for the number of descriptors to be opened by a process.
You can reset this restriction by editing this file
/etc/sysctl.conf
or a more graceful approach is to use some module that would take care and have a connectionpool to monitor over the opened file descriptors.
You may try node-graceful-fs or filequeue
Git source :
https://github.com/isaacs/node-graceful-fs
https://github.com/treygriffith/filequeue.git
Install apppropriate node modules by
npm install node-graceful-fs
or
npm install filequeue
and replace your fs from default to
var fs = require('graceful-fs')
or
var fs = new FileQueue(100);
Personally i feel filequeue is better queuing system.
Related
When I try to run hexo init in Git Bash in Windows10, it fail and show following :
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': Failed to connect to localhost port 1080: Connection refused
WARN git clone failed. Copying data instead
FATAL {
err: [Error: ENOENT: no such file or directory, scandir 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\hexo-cli\assets'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\hexo-cli\\assets'
}
} Something's wrong. Maybe you can find the solution here: %s http://hexo.io/docs/troubleshooting.html
How does it happen and how do we solve it?
I had the issue too. Tried again after a few minutes it worked. It due to bad access to github.com from China.
Try to run the same command from powershell non admin. If it does not work, try npx hexo init
I have a sails web app in an intranet environment. An average of ~12 users are logged in at the same time. Eventually I get the classic connection refused message from sails-postgresql that lasts for at least 3 minutes, denying all http requests made to the app.
Error creating a connection to Postgresql using the following settings:
{
...
schema: true,
ssl: false,
adapter: 'sails-postgresql',
poolSize: 50
...
}
I either get { [Error: write ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'write' } or { [Error: write ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }.
My PostgreSQL logs the following message:
No connection could be made because the target machine actively refused it.
As you can see, my poolSize in sails.config.connections is set to 50 and my max_connections in postgresql.conf is set to 100. I'm not using this database for something else.
Is my poolsize set ok? Is it a problem from Sails or is it Postgres'?
Try increasing max_connections in postgres config file postgresql.conf, in my Ubuntu 15.04 linux it is located in this path:
/etc/postgresql/9.4/main/postgresql.conf
I recently upgraded by version of nodejs on my windows azure web application from 0.12.0 to 0.12.6. Since then, whenever I relaunch my app on visual studio online editor, the console reports a significant errors like these ones:
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\recommendationModal.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\recommendationModal.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\register.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\register.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\search.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\search.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\spinningWheel.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\spinningWheel.handlebars' }
glob error { [Error: ENOTSUP, scandir 'D:\home\site\wwwroot\views\partials\stylesFilterButtons.handlebars']
errno: -4049,
code: 'ENOTSUP',
path: 'D:\\home\\site\\wwwroot\\views\\partials\\stylesFilterButtons.handlebars' }
All of the files in the error descriptions are handlebars partials.
I run the same app on my local development environment (linux with nodejs 0.12.6) and these errors never show up.
At first glance, it looks like there is something broken on azure websites when running your app on 0.12.6, but I'd like to post this situation here in SO to see if other people have faced the same issue and how they managed to resolve it.
This very much looks like this bug. Sounds like you may have glob 5.0.13 or earlier installed. Try 5.0.14 and it will hopefully solve your problem.
Just had the same issue with Azure. Mine happened to be glob as one comment stated.
express-handlebars has fixed this issue if you update to 3.0.0
I tried using Graphdat NodeJS module to monitor my we app but I'm encountering a problem.
My server is running in a Amazon EC2 instance, Ubuntu 12.10 x64.
When I start my node app it prints
Graphdat Info: Graphdat (v0.4.6) is enabled
Graphdat Info: Will send to agent on /tmp/gd.agent.sock
But as soon as I load the page in the browser it prints
Graphdat Error: gd.agent.sync: connection failed (/tmp/gd.agent.sock): { [Error: connect ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'connect' }
Found it. The script provided to install the logger was not successfully installed and it wasn't running.
curl -s -d '{"token":"api.xxxxxxxx"}' -H 'Content-Type: application/json' https://dashboard.graphdat.com/agent/install | sh
I try to install remotely node.js + now.js + mongoDB on a newly created Ubuntu 11.04 system (64 bits).
I created a structure like this:
/home/xxx/server.js
/home/xxx/node/
/home/xxx/node_modules/now/
/home/xxx/http/index.html
No problem with node.js and now.js, it works just fine but I have a hard time trying to install and setup mongoDB.
I went to the root of my machine and installed Mongodb this way:
cd
sudo apt-get install mongodb
I don't know if I should but I created a data/db folder like this:
cd
mkdir /data/db
chown `id -u` /data/db
When done, I installed the mongodb driver for node on the appropriate folder:
cd /home/xxx/
npm install mongodb
Then I started the node server. My static page appears as it should but this is what I get on the ssh terminal after about 10 seconds:
[TypeError: Cannot read property 'arbiterOnly' of undefined]
TypeError: Cannot read property 'arbiterOnly' of undefined
at /home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:558:22
at [object Object].checkoutReader (/home/xxx/node_modules/mongodb/lib/mongodb/connection/server.js:575:16)
at /home/xxx/node_modules/mongodb/lib/mongodb/db.js:1344:79
at Db._executeQueryCommand (/home/xxx/node_modules/mongodb/lib/mongodb/db.js:1555:5)
at Cursor.nextObject (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:455:13)
at Array.0 (/home/xxx/node_modules/mongodb/lib/mongodb/cursor.js:162:12)
at EventEmitter._tickCallback (node.js:192:40)
Tue Apr 24 2012 07:12:45 GMT+0200 (CEST) [GET] http://www.verysurf.com/proxyheader.php
error loading file httphttp://www.verysurf.com/proxyheader.php: { [Error: ENOENT, No such file or directory 'httphttp://www.verysurf.com/proxyheader.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://www.verysurf.com/proxyheader.php' }
What is this 'arbiterOnly' error message about?
What do I do wrong?
I googled this thing but there's not much to find about it.
And that "www.verysurf.com" url at the end of the error message, it's not always the same one. 5 minutes before I got this one (and I didn't change anything, just restarted the node server):
error loading file httphttp://59.53.91.9/proxy/judge.php: { [Error: ENOENT, No such file or directory 'httphttp://59.53.91.9/proxy/judge.php']
errno: 33,
code: 'ENOENT',
path: 'httphttp://59.53.91.9/proxy/judge.php' }
I really don't know what these url's are about.
Any help please?
Thank you.
I don't know why it's triggering that particular error message, but it looks to me like someone is or someones are sniffing your webserver to see if it's an open proxy (which it isn't). Some HTTP servers, notably Apache, are easily misconfigured to proxy any request to a third party:
http://en.wikipedia.org/wiki/Open_proxy
I get the very same message ([TypeError: Cannot read property 'arbiterOnly' of undefined]) when trying to request the database before the connection is fully initialized.
Make sure db.open() has finished (successfully)