Try ERPNext Buy Support Partners Foundation

Error in console: net::ERR_CONNECTION_REFUSED

Hello again!

I’ve been having this error for a while… Does’t seem to cause any major issue but it’s bothering me…

Every 10 seconds or so, in console I get this:

GET http://erp.medicocoiffure.com:9000/socket.io/?EIO=3&transport=polling&t=LxdYOAN net::ERR_CONNECTION_REFUSED

I search the forum for a solution but still wasn’t able to fix it… I always update to latest version but nothing will fix it…

Any idea where the problem might be?

Thanks guys!

G.

Hi @bardbq,

could you please share more information on the configuration, is it a --production installation, does it have DNS multitenant on? Have you checked your firewall settings (if applicable) if this might be blocking this call?

Hello,

Thanks for you reply. I’m using a EC2 Ubuntu instance hosted at Amazon Web Services. It is a production installation with DNS mutitenant OFF. I made sure incoming TCP port 9000 was open to all traffic sources (0.0.0.0/0 and ::/0) in instance security group settings.

Am I forgetting something?

Thanks!

G.

Hi @bardbq,

Did you find solution/workaround to it ?

I am facing same error.

Try changing the Socket.IO PORT, Looks like 9000 is a bit busy. Change it within your [frappe-bench]/sites/common_site_config.json file.

The parameter name would be “socketio_port”. Try 9001?

1 Like

Hi Achilles,

Thanks for your help. but still the same error continues with port 9001 !
:slight_smile:

Hello @jignesh_shah,

Log into Amazon AWS Console, select your instance and edit the security group to add these rules:

Inbound:

Custom TCP Rule - TCP - 9000 - 0.0.0.0/0
Custom TCP Rule - TCP - 9000 - ::/0

Outbound:

Custom TCP Rule - TCP - 9000 - 0.0.0.0/0
Custom TCP Rule - TCP - 9000 - ::/0

Hi bro, I am facing same error, I did turn off firewall , please help me ! thank so much

Use

bench socketio
bench build
bench start/restart

and add below the code in socketio.js if cipher mismatch error occur

 var app = require('express')();

//var server = require('https').Server(app);

var cookie = require('cookie')
var fs = require('fs');
let options = {
   key: fs.readFileSync("path/to/ssl/key"),
   cert: fs.readFileSync("path/to/ssl/.crt file")
};
var server = require('https').Server(options,app);
.
.......

Hello!

Did you ever solve this issue?

It seems that socketio in the browser is trying to GET on port 9000, while under https it is served without port.

For example my site is on https:// erp .example. com. Socketio in the browser is polling on https:// erp. example.com:9000, while it should be polling on https: //erp. example.com.

Any suggestions?

I am seeing the same thing.

I just ran:

bench setup socketio;
sudo supervisorctl restart all;  # Or stop and start "bench" some other way.

It seems to work now

A good check if socketio is doing its job is to like a post in Social.

It’s quick and easy since you can (stupidly) like your own post.

Go to the “Social” module, create a post then click on the heart. If you have to refresh the page to get it to turn red then SocketIO is still misconfigured. Otoh, if it turns red after a moment, you can be sure you’ve got SocketIO firing on all cylinders.

I tried your solution, but it didn’t work. Seems to be a problem because I have enabled https (and maybe because it is on a subdomain?). I think an update to socketio.js in apps/frappe is required to solve this.

You said:

Socketio in the browser is polling on https:// erp. example.com:9000, while it should be polling on https: //erp. example.com.

That is what I was seeing in Chrome browser console

https://erp.erpnext.host:9000/socket.io/?EIO=3&transport=polling&t=NFfJoh8 net::ERR_SSL_PROTOCOL_ERROR

After running the socketio setup I can see in the network tab that it has dropped the reference to port 9000

https://erp.erpnext.host/socket.io/?EIO=3&transport=polling&t=NFfZYka&sid=eyMrlDWEo9DB8ZsCAAAB

To be completely accurate, I did:

sudo -A bench setup supervisor;
sudo -A supervisorctl restart all;
bench setup socketio;
sudo -A supervisorctl restart all;
sudo -A service nginx stop;
sudo -A service nginx start;

Did you have a look at : ${BENCH}/logs/node-socketio.error.log ??
Did you reboot?
Did you R your browser page to force a full complete reload?

I started up another site without production mode.

I am finding that …

bench setup socketio;

… does NOT fix the problem.

I have done all the steps you mentioned (without the -A in sudo, but that shouldn’t matter), but I still have https://erp.erpnext.host:9000/socket.io/?EIO=3&transport=polling&t=NFigA-
in the console instead of https://erp.erpnext.host/socket.io/?EIO=3&transport=polling&t=NFigA-

logs/node-socketio.error.log shows:

    Error: listen EADDRINUSE: address already in use :::9000
at Server.setupListenHandle [as _listen2] (net.js:1313:16)
at listenInCluster (net.js:1361:12)
at Server.listen (net.js:1447:7)
at Object.<anonymous> (/home/erpmwp/frappe-bench/apps/frappe/socketio.js:26:8)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1340:8)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 9000
}

However I’m not sure if this is from now or from during the setup.

Anything else I can try?

Thank you!

I did a full reboot of the VM and now it is working as expected! Many thanks for your help!

Hah! Cool! I was starting to worry I was being no help at all.

I did get my production instance working perfectly with this. It frequently stopped working, but now it seems to operate consistently.