# 确保 Sidekiq 正在运行吗？

**URL:** https://meta.discourse.org/t/ensure-sidekiq-is-running/64774
**Category:** Self-hosting
**Created:** [2017年六月19日 23:02 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774 "2017-06-19T23:02:17Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [2017年六月19日 23:02 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/1 "2017-06-19T23:02:17Z")

</div>

This started today out of the blue.

![](https://global.discourse-cdn.com/meta/original/3X/2/0/2001778ddceb882fc1c0e46e515b64d192f2fb10.png)

I’ve searched the forum and tried all this:

1. Upgrading manually to the latest git and rebuilding the app
2. Rebooting the machine as @codinghorror suggested
3. Checked diskspace, over 20GB free
4. Trying what @clay suggested - trying to flush the queue (and then restarted and EVEN rebooting the machine) and I got:

> [1] pry(main)\> Sidekiq.redis { |r| puts r.flushall }  
> Passing ‘flushall’ command to redis as is; administrative commands cannot be effectively namespaced and should be called on the redis connection directly; passthrough has been deprecated and will be removed in redis-namespace 2.0 (at (pry):1:in `block in **pry** ’)  
> OK  
> =\> nil

Taking my clues from here, nothing seems to work. Any ideas what’s going on and how to fix it?

> [@"Ensure sidekiq is running." when it is definitely running](https://meta.discourse.org/t/ensure-sidekiq-is-running-when-it-is-definitely-running/33936/19):
>
> @codinghorror @neil @sam I fixed it. Here’s what I had to do: cd /var/discourse ./launcher ssh app rails c Sidekiq.redis { |r| puts r.flushall } Then I had to exit the container and ./launcher restart app That cleared the Sidekiq Redis queue and everything started back up. If I had to guess, I upgraded Discourse when there was a backup job in the queue in Redis and somehow, upon restarting the app, the name of a class or something associated with Redis, Sidekiq, or backing up had changed, s…

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [2017年六月19日 23:15 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/2 "2017-06-19T23:15:24Z")

</div>

Here’s what finally worked:

I ran this again  
`Sidekiq.redis { |r| puts r.flushall }`

Then I restarted the app  
`sudo ./launcher restart app`

Then I rebooted the machine (again)

And now it started working.

Oddly, my logs are completely empty.

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2017年六月20日 00:30 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/3 "2017-06-20T00:30:11Z")

</div>

I have the same issue. This ‘solution’ is not satisfying since:

- it does not tell why this happened.
- it does not make clear which steps are required, and what they do exactly.
- it requires a reboot!!!

I would expect `restart` to fix it, and I certainly do not plan on rebooting the machine.

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [2017年六月20日 06:32 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/4 "2017-06-20T06:32:27Z")

</div>

> [@hellekin](#):
>
> This ‘solution’ is not satisfying since

I would agree, I really don’t know why it happened and what exactly fixed it. Just that repeating the steps over a few times and rebooting a few times fixed it, but like you said I’m not convinced that’s the long term solution.

---

<div class="post-metadata">

### Author: ![Stranik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stranik/32/85638_2.png) [@Stranik](https://meta.discourse.org/u/Stranik)
#### Post date: [2017年六月20日 06:53 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/5 "2017-06-20T06:53:27Z")

</div>

Hello. So what actions should I take?

 ![](https://global.discourse-cdn.com/meta/original/3X/a/5/a5c659c269931e2f4312cb21e00743ccc36e84f0.jpg)

---

<div class="post-metadata">

### Author: ![RBoy](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@RBoy](https://meta.discourse.org/u/RBoy)
#### Post date: [2017年六月20日 06:58 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/6 "2017-06-20T06:58:29Z")

</div>

First upgrade to the latest version (there are some new patches related to this I think that went in a few hours ago). Open `yourwebsite/admin/upgrade` and upgrade to the latest version (+101 is working for me now, so you’re good there)

Then from the terminal

> cd /var/discourse  
> sudo ./launcher enter app  
> rails c  
> Sidekiq.redis { |r| puts r.flushall }  
> exit  
> exit  
> sudo ./launcher restart app

Then `reboot` the machine. I did this loop 2 times and it solved the issue.

I think someone also mentioned you can try a few things

1. Leave it for 24 hours and the scheduler should kick off again and this error should go away
2. Force the schedules to start, open `yourwebsite/sidekiq`, goto `scheduler` and trigger the schedule `Jobs::VersionCheck`

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [2017年六月20日 12:33 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/7 "2017-06-20T12:33:29Z")

</div>

> [@RBoy](#):
>
> Leave it for 24 hours and the scheduler should kick off again and this error should go away

Yeah, simply updating and waiting 24 hours (or manually triggering `Jobs::VersionCheck` in the web UI as you suggested) should suffice, no messing within Rails necessary 🙂

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2017年六月22日 21:32 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/8 "2017-06-22T21:32:54Z")

</div>

I simply upgraded to the latest version (now running v1.9.0.beta2 +98), and didn’t have to reboot.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2024年六月8日 12:44 UTC](https://meta.discourse.org/t/ensure-sidekiq-is-running/64774/9 "2024-06-08T12:44:34Z")

</div>

此主题已在 2545 天后自动关闭。不再允许回复。
