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

UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT #1473

Closed
exislow opened this issue Sep 16, 2019 · 8 comments
Closed

UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT #1473

exislow opened this issue Sep 16, 2019 · 8 comments

Comments

@exislow
Copy link

exislow commented Sep 16, 2019

Description

Everytime I try to setup a worker (consumer) I get UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT.

I have tried the examples from https://github.com/luin/ioredis#readme and everything works fine. But everytime I try to create a consumer with the same settings as the bare ioredis example I get the following exception.

(node:209387) UnhandledPromiseRejectionWarning: Error: connect ETIMEDOUT
    at Socket.<anonymous> (node_modules/ioredis/built/redis/index.js:275:31)
    at Object.onceWrapper (events.js:281:20)
    at Socket.emit (events.js:193:13)
    at Socket.EventEmitter.emit (domain.js:481:20)
    at Socket._onTimeout (net.js:450:8)
    at listOnTimeout (internal/timers.js:535:17)
    at processTimers (internal/timers.js:479:7)
From previous event:
    at Object.isRedisReady (node_modules/bull/lib/utils.js:26:10)
    at Queue._registerEvent (node_modules/bull/lib/queue.js:452:10)
    at _initializingProcess.isReady.then (node_modules/bull/lib/queue.js:340:21)
(node:209387) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:209387) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can somebody help me?

Minimal, Working Test code to reproduce the issue.

import Queue from 'bull';

const Redis = require('ioredis');
const redis = new Redis();


const t1 = async (r) => {
  const addQ = new Queue('add');

  try {
    const b = await addQ.process(async (job, done) => {
      const { x, y } = job.data;

      console.log('data', job.data);

      done(null, { res: x + y });
    });
    console.log('proc', b);
  } catch (e) {
    throw e;
  }
};

t1();

Bull version

bull: 3.10.0
node: 11.15.0

@manast
Copy link
Member

manast commented Sep 16, 2019

The only way you will get this error is if you are not running the Redis server on localhost and on default port 6379.

@manast manast closed this as completed Sep 16, 2019
@exislow
Copy link
Author

exislow commented Sep 17, 2019

Dude, as I wrote to you: The ioredis examples just running thorugh perfectly with exactly the same setup. But this example above is not! Thus, redis is running on localhost at port 6379

What an attitude... Just closing without handling something. Would you like to reopen this?

@manast
Copy link
Member

manast commented Sep 17, 2019

Thing is, this is not a support forum. We will probably have one in the future. I rather spend my limited time fixing/implementing features than solving your specific code.
Do you honestly think there is a bug in Bull for such a simple example that thousands of users have not discovered yet? You have loads of examples, tests, documentation, etc. Start with something simple, get it right and move to more complex things.

@exislow
Copy link
Author

exislow commented Sep 17, 2019

I do not assume to have a support forum. But there are several closed issues which have the same problem. And none of them received real attention. Aparently this is a thing with Bull, but I guess you do not want to see this.

My code above is a SUPER simple code (it just adds two numbers). But the connection to redis fails. With exact the same settings using ioredis directly I can connect and store values in Redis. But Bull fails to connect to the very same setup with the very same settings. I mean, if you do not want to spent time with this bug, sure... I will just look for another solution except Bull.

@ashkank83
Copy link

You can try and run some of the sample codes to make sure your environment is setup correctly. If that worked then maybe go through the documentation to see what you're missing! The library is working perfectly for us as well as at least 1203 other libraries here in github (based on github)!

maybe try adding the redis connection when you're creating the queue like the sample below:

var videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');
var audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1', password: 'foobared'}}); // Specify Redis connection using object

"What an attitude... Just closing without handling something. Would you like to reopen this?"
He's spending a lot of his free time to maintain this amazing library and is giving it to us to use for free, I think a bit appreciation and respect isn't bad!

@bendytree
Copy link

Looks like an issue with ioredis when using bluebird:

global.Promise = require("bluebird"); // the problem

var Queue = require('bull');
var queue = new Queue('test', "redis://127.0.0.1:6379");

queue.process(function(job, done){
  console.log("Process...");
  done();
});

queue.add({foo:"bar"});

It runs fine if you drop that bluebird line. The error is:

 Unhandled rejection Error: connect ETIMEDOUT
  at Socket.<anonymous> (/myapp/node_modules/ioredis/built/redis/index.js:282:31)...

My setup:

node: 10.10.0
npm: 6.4.1
bull: 3.12.0
bluebird: 3.7.1

@exislow
Copy link
Author

exislow commented Nov 25, 2019

@bendytree This ist the solution. Thank you very much.

@manast and @ashkank83: I hope you now realize that you have been wrong. Maybe in future you will not be the arrogant anymore.

@manast
Copy link
Member

manast commented Nov 25, 2019

@exislow how are we wrong? was it a bug with Bull or was it not?

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