Sidekiq: Potential bug in superfetch?

Created on 25 Apr 2017  Â·  4Comments  Â·  Source: mperham/sidekiq

Ruby version:
Sidekiq / Pro / Enterprise version(s):
sidekiq 4.2.10
sidekiq-pro 3.4.5

I think there is a bug in the superfetch code which makes it not play well with workers with underscores in their names. On line 76 of the superfetch code:

 _, id, *name = que.split("_")

que is a string like "queue:sq_ridiculous_power_worker.1:27:de2db764ff63_ridiculous_power_normal_priority"

which will explode into

id = "ridiculous"
name = ["power", "worker.1:27:de2db764ff63", "ridiculous", "power", "normal", "priority"]

On lines 82-83, name is then joined to form a queue name and the job is pushed there. However, since part of the worker name is included, this pushes the job onto a non-existent queue and it never comes back.

Most helpful comment

Ok, so the problem is that queue names frequently contain underscores. super_fetch concatenates the two together:


Boom, impossible to split now since your hostname also contains underscores. The proper fix is to change how super_fetch concatenates to use a different character, one that will never appear in a hostname or queue name. I think one such character is |.

I'll make this change and call it 3.5.0 since it is a "data structure" change. The only requirement is that the old processes must be shut down cleanly so jobs aren't orphaned in the old private queues.

All 4 comments

Sounds likely. It's about time for Pro 3.4.6 so I'll fix this if possible and get a release later this week.

Great thanks! Please let me know if I can be helpful.

On Tue, Apr 25, 2017 at 3:09 PM Mike Perham notifications@github.com
wrote:

Sounds likely. It's about time for Pro 3.4.6 so I'll fix this if possible
and get a release later this week.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mperham/sidekiq/issues/3443#issuecomment-297134227,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABDVplL0OXGT7wCi7TWRiT6JQGBta7Weks5rzkTpgaJpZM4NHrcc
.

>

Sent from Gmail Mobile

Ok, so the problem is that queue names frequently contain underscores. super_fetch concatenates the two together:


Boom, impossible to split now since your hostname also contains underscores. The proper fix is to change how super_fetch concatenates to use a different character, one that will never appear in a hostname or queue name. I think one such character is |.

I'll make this change and call it 3.5.0 since it is a "data structure" change. The only requirement is that the old processes must be shut down cleanly so jobs aren't orphaned in the old private queues.

Sounds like a plan. We're affected by this bug as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajcybage picture rajcybage  Â·  3Comments

aglushkov picture aglushkov  Â·  3Comments

HenleyChiu picture HenleyChiu  Â·  4Comments

mperham picture mperham  Â·  4Comments

homanchou picture homanchou  Â·  3Comments