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

Warning: a promise was created in a handler at #518

Closed
jcald1 opened this Issue Apr 27, 2017 · 11 comments

Comments

Projects
None yet
6 participants
@jcald1

jcald1 commented Apr 27, 2017

Using 3.0.0-alpha.2 on Node 6.9.1 on Ubuntu. I get the following warnings. I'm not getting these warnings with v2.2.6

(node:3215) Warning: a promise was created in a handler at /usr/apps/das/das_rtc/nodejs/TestConcurrency/node_modules/bull/lib/queue.js:811:5 but was not returned from it, see http://goo.gl/rRqMUw
at new Promise (/usr/apps/das/das_rtc/nodejs/TestConcurrency/node_modules/bluebird/js/release/promise.js:79:10)

The warnings are printed even before any messages are placed on the queue for this code to process:

var request = require('request');
var sleep = require('sleep');
var Queue = require('bull');
var queue = Queue('testqueue', 6379, '127.0.0.1');

queue.process(function (job, done) {
    console.log('**Processing Queue Message: ' + JSON.stringify(job.data));
    console.log('Sending HTTP messaeg: ' + JSON.stringify(job.data));

    request('http://localhost:8080/respond1', function (error, response, body) {
        console.log('****In HTTP Callback');
        //console.log('error:', error); // Print the error if one occurred
        //console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
        console.log('body:', body); // Print the HTML for the Google homepage.

        done();
    });
});
@bradvogel

This comment has been minimized.

Contributor

bradvogel commented Apr 27, 2017

Add return null; as the last line of the function you pass to process(), per the link (http://goo.gl/rRqMUw)

@manast

This comment has been minimized.

Member

manast commented May 24, 2017

@jcald1 would you mind to test if this issue exists in 3.0.0-rc1?

@andrewburgess

This comment has been minimized.

Contributor

andrewburgess commented May 25, 2017

I'm seeing this warning when using delayed jobs with a crontab, coming from

_this.updateDelayTimer(nextTimestamp);

Using 3.0.0-rc1

@jcald1

This comment has been minimized.

jcald1 commented May 26, 2017

@manast, I'm not seeing the warnings any longer with 3.0.0-rc1

@fcarreiro

This comment has been minimized.

fcarreiro commented Jul 6, 2017

I'm seeing this with delayed jobs with 3.0.0-rc2. Even after adding the return null.
It only seems to happen with delayed jobs so it might be related to what @andrewburgess says.

@manast

This comment has been minimized.

Member

manast commented Jul 6, 2017

It is difficult to fix without being able to reproduce. Lets keep this open until somebody gets more information. At least we can say that the error is harmless, just a warning from bluebird where a error handling is missing somewhere.

@fcarreiro

This comment has been minimized.

fcarreiro commented Jul 15, 2017

@manast I finally made some time to create an example to reproduce this bug.
I'm attaching a bull-promises.zip file with

  • docker-compose.yml
  • Dockerfile
  • package.json
  • app.js

You can see all the precise versions there (bull 3.0.0-rc.4 and node 8).

You are free to choose not to use Docker to run the example, but I'll write the instructions to run it with Docker:

(1) docker-compose build
(2) docker-compose run --rm worker node app.js seed

Creating network "bullpromises_default" with the default driver
Creating bull-promises-redis ... 
Creating bull-promises-redis ... done
Hit CTRL+C to stop
Seeding 1000 delayed messages...
Done, exiting.

(3) docker-compose run --rm worker node app.js recover

Starting bull-promises-redis ... done
Hit CTRL+C to stop
Recovering messages, processing...
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:279:17 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
[2017-07-15T10:51:46.889Z] Processed #109
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
(node:1) Warning: a promise was created in a handler at home/worker/node_modules/bull/lib/queue.js:750:15 but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (/home/worker/node_modules/bluebird/js/release/promise.js:79:10)
[2017-07-15T10:51:46.984Z] Processed #42
[2017-07-15T10:51:46.996Z] Processed #535
[2017-07-15T10:51:47.007Z] Processed #963
[2017-07-15T10:51:47.018Z] Processed #14
[2017-07-15T10:51:47.031Z] Processed #240
[2017-07-15T10:51:47.037Z] Processed #93
[2017-07-15T10:51:47.046Z] Processed #627
[2017-07-15T10:51:47.051Z] Processed #363
[2017-07-15T10:51:47.060Z] Processed #609
[2017-07-15T10:51:47.065Z] Processed #187
[...]

If at any point you need to start over, execute docker-compose down -v and you are clean.

Hope this helps!

@zidsi

This comment has been minimized.

zidsi commented Aug 30, 2017

Still here at v.3.0.0-rc.9

In my case trace looks like this

(node:10624) Warning: a promise was created in a handler but was not returned from it, see http://goo.gl/rRqMUw
    at new Promise (project\node_modules\bluebird\js\release\promise.js:79:10)
    at Command.initPromise (project\node_modules\bull\node_modules\ioredis\lib\command.js:63:18)
    at new Command (project\node_modules\bull\node_modules\ioredis\lib\command.js:51:8)
    at Script.execute (project\node_modules\bull\node_modules\ioredis\lib\script.js:22:17)
    at Redis.updateDelaySet (project\node_modules\bull\node_modules\ioredis\lib\commander.js:164:20)
    at Object.updateDelaySet (project\node_modules\bull\lib\scripts.js:248:25)
    at delayUpdate (project\node_modules\bull\lib\queue.js:702:15)
    at Queue.updateDelayTimer (project\node_modules\bull\lib\queue.js:718:25)
    at project\node_modules\bull\lib\queue.js:299:17
From previous event:
    at project\node_modules\bull\lib\queue.js:297:56
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
    at Queue._initProcess (project\node_modules\bull\lib\queue.js:293:8)
    at Queue.process (project\node_modules\bull\lib\queue.js:514:15)
   ....

and looks like this patch of queue.js removes the warning and should not impact functionality...

@@ -298,6 +298,7 @@
         if(timestamp){
           _this.updateDelayTimer(timestamp);
         }
+        return null;
       });
     }).then(function(){
       //
@@ -305,6 +306,7 @@
       // This is necessary when redis connection is unstable, which can cause the pub/sub to fail
       //
       _this.guardianTimer = setGuardianTimer(_this);
+      return null;
     });
 
     this.errorRetryTimer = {};
@manast

This comment has been minimized.

Member

manast commented Aug 30, 2017

Ok, I will take a look into this.

@manast manast added the bug label Aug 30, 2017

@zidsi

This comment has been minimized.

zidsi commented Aug 30, 2017

I guess one more runaway promise at delayUpdate...

My diff to v.3.0.0-rc.9 now looks like this. Hope it helps.

--- a/<html>queue.js </html>
+++ b/<html><b>Current File</b></html>
@@ -298,6 +298,7 @@
         if(timestamp){
           _this.updateDelayTimer(timestamp);
         }
+        return null;
       });
     }).then(function(){
       //
@@ -305,6 +306,7 @@
       // This is necessary when redis connection is unstable, which can cause the pub/sub to fail
       //
       _this.guardianTimer = setGuardianTimer(_this);
+      return null;
     });
 
     this.errorRetryTimer = {};
@@ -706,10 +708,12 @@
           nextTimestamp = Number.MAX_VALUE;
         }
         _this.updateDelayTimer(nextTimestamp);
+        return null;
       }).catch(function(err){
         _this.emit('error', err, 'Error updating the delay timer');
       });
       _this.delayedTimestamp = Number.MAX_VALUE;
+      
     };
 
     if(delay){
@manast

This comment has been minimized.

Member

manast commented Sep 21, 2017

fixed in afe960b

@manast manast closed this Sep 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment