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]: Sandbox .updateData unexpected behavior regarding job data #2731

Closed
1 task done
tolgap opened this issue Aug 25, 2024 · 3 comments · Fixed by #2739 · May be fixed by https-quantumblockchainai-atlassian-net/ossinsight#886
Closed
1 task done
Labels
bug Something isn't working

Comments

@tolgap
Copy link

tolgap commented Aug 25, 2024

Version

v5.12.6

Platform

NodeJS

What happened?

I cannot get job.updateData and job.moveToDelayed methods working without having them fail the first couple of times. Then when the jobs are retried (like 2 or 3 times) it magically succeeds.

I am using Sandboxed workers of course 😄.

I'm trying to utilize the Step Pattern in your docs. But the only difference is: each step "builds on top of the jobData" of previous steps. But I keep losing the fields I've added in the step before. Its like job.updateData() updates the data in a "delayed" fashion if it contains new keys.

How to reproduce.

Here's a reproduction within bullmq tests in my forked repo: https://github.com/taskforcesh/bullmq/compare/master...tolgap:bullmq:chore/reproduce-issue-2731?expand=1

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@tolgap tolgap added the bug Something isn't working label Aug 25, 2024
@manast
Copy link
Contributor

manast commented Aug 26, 2024

it is unlikely a bug as trivial as this exists in the codebase, if you could please provide some minimal code to reproduce it we can certainly help you out.

@manast manast removed the bug Something isn't working label Aug 26, 2024
tolgap added a commit to tolgap/bullmq that referenced this issue Aug 26, 2024
@tolgap
Copy link
Author

tolgap commented Aug 26, 2024

@manast I agree with your sentiment. But here's a gist of my issue. I've tried to reproduce my issue in a branch here: https://github.com/taskforcesh/bullmq/compare/master...tolgap:bullmq:chore/reproduce-issue-2731?expand=1

I'm trying to utilize the Step Pattern in your docs. But the only difference is: each step "builds on top of the jobData" of previous steps. But I keep losing the fields I've added in the step before. Its like job.updateData updates the data in a "delayed" fashion if it contains new keys.

$> yarn test


  sandbox step pattern
    1) should process steps and complete


  0 passing (554ms)
  1 failing

  1) sandbox step pattern
       should process steps and complete:

      AssertionError: expected { step: 'FINISH', …(1) } to deeply equal { step: 'FINISH', …(2) }
      + expected - actual

       {
         "extraDataFinishedStep": "finish data"
      +  "extraDataSecondStep": "second data"
         "step": "FINISH"
       }
      
      at Worker.<anonymous> (tests/test_sandbox_step_pattern.ts:45:34)
      at Worker.emit (node:events:513:28)
      at Worker.emit (src/classes/queue-base.ts:111:20)
      at Worker.emit (src/classes/worker.ts:323:18)
      at handleCompleted (src/classes/worker.ts:757:14)
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at Worker.processJob (src/classes/worker.ts:806:14)
      at Worker.retryIfFailed (src/classes/worker.ts:1007:16)

tolgap added a commit to tolgap/bullmq that referenced this issue Aug 26, 2024
@tolgap tolgap changed the title [Bug]: Sandbox emulated commands are not being awaited [Bug]: Sandbox .updateData unexpected behavior regarding job data Aug 27, 2024
@manast
Copy link
Contributor

manast commented Aug 27, 2024

Thanks for the extra information, we are looking into it.

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
2 participants