Giter VIP home page Giter VIP logo

Comments (5)

pdkproitf avatar pdkproitf commented on July 29, 2024 1

My current solutions:

SidekiqUniqueJobs.reflect do |on|
  on.lock_failed do |job_hash|
    # There is a problem where job is executed and digest has been remove from SidekiqUniqueJobs::Digests.new.entries BUT the job_id still exists.
    # If your worker using SidekiqUniqueJobs's lock stratery with reject on conflit, then it will reject new job from being added to the queue even the job nolonger available.
    # This aims to handle that case and clear the invalid digest
    if job_hash['class'] == 'YourWokerClassName' &&
        Redis.current.get(job_hash['lock_digest']) &&
        Redis.current.zrank('uniquejobs:digests', job_hash['lock_digest']).nil?
      SidekiqUniqueJobs::Digests.new.delete_by_digest(job_hash['lock_digest'])
      job_hash['class'].constantize.perform_async(*job_hash['args'])
    end
  end
end

from sidekiq-unique-jobs.

JeremiahChurch avatar JeremiahChurch commented on July 29, 2024

further debugging: "Delete All" on the web UI - locks are shown as cleared out on the UI. However the job still reports that the same key already exists.

> SidekiqUniqueJobs::Digests.new.entries
{"uniquejobs:f4f7dbd00db80a837590354401621908"=>1664566736.618991,
 "uniquejobs:e5a9ea4f8e153a35f6ded5f23fb1e527:RUN"=>1664566738.4878461,
 "uniquejobs:9a10d00cc95305531be30f13b956005c:RUN"=>1664566738.8416214,
 "uniquejobs:2b19449a7adaa1461106a72cabe12a6f:RUN"=>1664566738.8636317,
 "uniquejobs:51cf0c68620db7b16d433b178e39d7e1:RUN"=>1664566739.4959993}

no match in the entries

however directly deleting by digest does succeed and releases the lock

> SidekiqUniqueJobs::Digests.new.delete_by_digest 'uniquejobs:1d6a8b849137793a8368e6513b58f436'
2022-09-30T19:41:59.911Z pid=16756 tid=ktw INFO: delete_by_digest(uniquejobs:1d6a8b849137793a8368e6513b58f436) completed in 1ms
=> 2
> ActivityItems::ItemCreateJob.perform_async
=> "324a590dbf84f5315c32cb09"

However then jobs can just be queued repeatedly even with until_and_while_executing. This seems the same as #734?

> ActivityItems::ItemCreateJob.perform_async
=> "4200cb3e8be0a9c5ba32ff7f"
> ActivityItems::ItemCreateJob.perform_async
=> "630c1eba5d46b279ba232a20"
> ActivityItems::ItemCreateJob.perform_async
=> "52389da6ff7d8daf89352f8a"
> ActivityItems::ItemCreateJob.perform_async
=> "1eda77d1672570eedada7b8f"

from sidekiq-unique-jobs.

lemboywp avatar lemboywp commented on July 29, 2024

We had the exact same problem today.

sidekiq (5.2.9)
sidekiq-unique-jobs (7.1.27)

from sidekiq-unique-jobs.

pdkproitf avatar pdkproitf commented on July 29, 2024

Same problem here:

sidekiq (6.4.1)
sidekiq-unique-jobs (7.1.7)

I'm also unable to find the digest in the locked list SidekiqUniqueJobs::Digests.new.entries
Here is where it check job_id by digest: CLICK FOR LINK:

  • The previous digest still exists which leads to prev_job_id being different from new_job_id:
  • Example Digest: uniquejobs:4cd6c68aa2b68f076fb793b18fd49f1e.

Screenshot_2022-11-02_at_3_24_06_PM

irb(main):419:0> Redis.current.get('uniquejobs:4cd6c68aa2b68f076fb793b18fd49f1e')
=> "5837f8f8bdd9977f02d0642d"

It seems like Cleanup Dead Locks couldn't delete the digest.

from sidekiq-unique-jobs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.