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

[Bug]: Stacktrace with limit removes the last error stack. #2487

Closed
1 task done
nocodehummel opened this issue Mar 23, 2024 · 5 comments
Closed
1 task done

[Bug]: Stacktrace with limit removes the last error stack. #2487

nocodehummel opened this issue Mar 23, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@nocodehummel
Copy link
Contributor

Version

5.4.5

Platform

NodeJS

What happened?

Our jobs have stackTraceLimit set, and we noticed that the error stack is not updated.

How to reproduce.

The problem is caused by an incorrect use of slice inside the Job class.

this.stacktrace.push(err.stack);
if (this.opts.stackTraceLimit) {
   this.stacktrace = this.stacktrace.slice(0, this.opts.stackTraceLimit);
}

Simple reproduction example to demonstrate the issue.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@nocodehummel nocodehummel added the bug Something isn't working label Mar 23, 2024
nocodehummel added a commit to nocodehummel/bullmq that referenced this issue Mar 23, 2024
@manast
Copy link
Contributor

manast commented Mar 25, 2024

yeah, I see, this actually a real bug as we are pushing the new stacks and then slicing them away if the length is larger stackTraceLimit.

manast pushed a commit that referenced this issue Mar 26, 2024
github-actions bot pushed a commit that referenced this issue Mar 26, 2024
## [5.4.6](v5.4.5...v5.4.6) (2024-03-26)

### Bug Fixes

* **connection:** accept all parameters for redis connection [python] ([#2486](#2486)) ([ce30192](ce30192))
* **job:** stack trace limit ([#2487](#2487)) ([cce3bc3](cce3bc3))
@roggervalf
Copy link
Collaborator

closing as there is a merged fix in v5.4.6

@xNest
Copy link

xNest commented Jun 28, 2024

hey, the solution does not allow stackTraceLimit to be set to 0, is this the desired behaviour?

@nocodehummel
Copy link
Contributor Author

@xNest how do you mean does not allow?

@xNest
Copy link

xNest commented Aug 6, 2024

If you pass 0 with the intention of not saving a stack trace, the limit will be ignored.

if (err?.stack) {
      this.stacktrace.push(err.stack);
      if (this.opts.stackTraceLimit) {
        this.stacktrace = this.stacktrace.slice(-this.opts.stackTraceLimit);
      }
    }

github-actions bot pushed a commit that referenced this issue Aug 7, 2024
## [5.12.1](v5.12.0...v5.12.1) (2024-08-07)

### Bug Fixes

* **job:** consider passing stackTraceLimit as 0 ([#2692](#2692)) ref [#2487](#2487) ([509a36b](509a36b))
* **job:** make sure json.dumps return JSON compliant JSON [python] ([#2683](#2683)) ([4441711](4441711))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants