# Webhook Won't Delete: CPU Rails to 100% for 30 Seconds, then 502 Error

**URL:** https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958
**Category:** Bug
**Created:** [28.Октябрь.2017 01:53:45 UTC](https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958 "2017-10-28T01:53:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Berto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/berto/32/77084_2.png) [@Berto](https://meta.discourse.org/u/Berto)
#### Post date: [28.Октябрь.2017 01:53:45 UTC](https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958/1 "2017-10-28T01:53:45Z")

</div>

I have an old Webhook that I want to delete. But when I go to delete it, things hang for 30 seconds and then a 502 Error pops up.

This dumps to console:

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/5/45cfc860a5c210d83590689b81bfcc64ef60afbf.png)

During this 30 seconds, one of my four ruby processes goes to 100% and stays there (I’m just monitoring this in `top`), so I think this is more of a bug or misconfiguration than an issue on my end (see note below).

Nothing is in my `/logs` page, but here’s my logs:

```plaintext
E, [2017-10-28T01:49:29.428736 #213] ERROR -- : worker=2 PID:28593 timeout (31s > 30s), killing

==> error.log <==
2017/10/28 01:49:29 [error] 209#209: *66829 upstream prematurely closed connection while reading response header from upstream, client: MY.IP.ADD.DY, server: _, request: "DELETE /admin/api/web_hooks/1 HTTP/1.1", upstream: "http://127.0.0.1:3000/admin/api/web_hooks/1", host: "forum.mydomain.com", referrer: "https://forum.mydomain.com/admin/api/web_hooks"

```

That’s after running `tail -f /var/log/nginx/error.log /var/log/nginx/error.log.1 /var/log/nginx/error.letsencrypt.log /shared/log/rails/unicorn.stderr.log` while inside of my web\_only container (my data and web containers are separated).

Note: I’m indeed having some problems elsewhere in my installation, much of it related to CloudFlare ([https://meta.discourse.org/t/cannot-save-theme-customizations-403-error-on-put/72854](https://meta.discourse.org/t/cannot-save-theme-customizations-403-error-on-put/72854)). But this is happening even without CloudFlare running at all, DNS or otherwise.

Thanks for any help. Not sure why this webhook’s so painful to kill - a short workaround would be to bump up the timeout??

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [29.Октябрь.2017 09:17:30 UTC](https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958/2 "2017-10-29T09:17:30Z")

</div>

Have you tried deleting that webhook from the rails console?

Something like

```plaintext
# ssh into your server
cd /var/discourse
./launcher enter app
rails c
WebHook.find(<id>).destroy

```

With “`<id>`” the id of the webhook which you can get when editing the details of the webhook.

- URL = `https://meta.discourse.org/admin/api/web_hooks/3`
- ID = `3`

---

<div class="post-metadata">

### Author: ![Berto](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/berto/32/77084_2.png) [@Berto](https://meta.discourse.org/u/Berto)
#### Post date: [29.Октябрь.2017 14:16:20 UTC](https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958/3 "2017-10-29T14:16:20Z")

</div>

Thanks, that worked!

Interestingly, it seemed to take less than 30 seconds to run that. Not sure why the web-based method took so long it had to time out.

Might be nice to get a longer timeout on some of these operations though?

Either way, much appreciated.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [29.Октябрь.2017 14:18:39 UTC](https://meta.discourse.org/t/webhook-wont-delete-cpu-rails-to-100-for-30-seconds-then-502-error/72958/4 "2017-10-29T14:18:39Z")

</div>


