question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stalledInterval not working properly

See original GitHub issue

BullMQ Version: 1.9.0

Trying to change the stalledInterval on a QueueScheduler does not seem to work properly.

My demo setup is this:

scheduler.js

"use strict";
const QueueScheduler = require("bullmq").QueueScheduler;
new QueueScheduler("testQ", {
    stalledInterval: 10000
});

worker.js

"use strict";
const Worker = require("bullmq").Worker;
new Worker("testQ", async (job) => {
    console.log(`Beginning Stalling: ${job.name} (${job.id})`);
    const a = new Date();
    while (new Date() - a < 40000) {} // Stall for 40 seconds
});

task-adder.js

"use strict";
const Queue = require("bullmq").Queue;
const queue = new Queue("testQ");
async function addTasks() {
    await queue.add(`testJob`, {
        attempts: 3,
        backoff: {
            type: "fixed",
            delay: 0
        }
    });
    queue.disconnect();
}
addTasks();

I start up 1 scheduler, then 1 worker and then I run task-adder once to kick the entire test off.

Attempting to set stalledInterval to 0 causes the following error message:

(node:18963) UnhandledPromiseRejectionWarning: ReplyError: ERR Error running script (call to f_890be59efdd64a4df5f5121df9680b166a884036): @user_script:28: ERR invalid expire time in set
    at parseError (PROJECT/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (PROJECT/node_modules/redis-parser/lib/parser.js:302:14)
(node:18963) 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:18963) [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.

According to what I read in the documentation, 0 should turn the stalling check off, is that correct?

Futhermore, when I set stalledInterval to 10000, it should mark a job as stalled after 10 seconds, right? This does not happen for me and the 30 second default timeout is used instead.

The worker also stops processing when it recovers from the artificial stalling and finishes processing the task, erroring due to a missing lock. There are definitely more jobs on the queue for it to process.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
Wolvancommented, Oct 22, 2020

Because I have jobs that have the potential to stall. I guess I should be using a sandbox’d script instead?

0reactions
Wolvancommented, Oct 22, 2020

I see. I’ll take that suggestion to heart, then. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

OptimalBits/bull - Gitter
I'm consistently getting "'Could not remove job {ID}'" when I try to remove an active job, any idea why? it's a long running...
Read more >
Stalled Jobs - BullMQ
A stalled job is moved back to the waiting status and will be processed again by another worker, or if it has reached...
Read more >
Problem Orders (Beta) - Malomo
From the Orders page, click on the Problem Orders button in the top right ... are the date and time of the last...
Read more >
Job Processing and Event Queue with Serverless Redis
Decoupling the side procedures will solve the above issues. ... stalledInterval: 300000, // How often check for stalled jobs (use 0 for never...
Read more >
Queue#add timeout option not failing a timed-out job #1895
If there is different / better pattern I should be following, feel free to point that out as well. Minimal, Working Test code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found