# Autoclosing topic causes 50x errors

**URL:** https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751
**Category:** Bug
**Created:** [February 3, 2015, 12:13am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751 "2015-02-03T00:13:35Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![loopback0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loopback0/32/37486_2.png) [@loopback0](https://meta.discourse.org/u/loopback0)
#### Post date: [February 3, 2015, 12:13am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/1 "2015-02-03T00:13:35Z")

</div>

As spotted over yonder.

> **[What the Daily WTF?](https://what.thedailywtf.com/login)**

At least 3 instances today where, as the autoclosure time hits, the server experiences “issues” with 500, 502, 504 errors being thrown for approx 10-15minutes.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 3, 2015, 12:29am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/2 "2015-02-03T00:29:42Z")

</div>

Hmm, we don’t see that here with autoclosing topics. Perhaps a volume of autoclose issue.

---

<div class="post-metadata">

### Author: ![loopback0](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loopback0/32/37486_2.png) [@loopback0](https://meta.discourse.org/u/loopback0)
#### Post date: [February 3, 2015, 12:43am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/3 "2015-02-03T00:43:13Z")

</div>

> [@codinghorror](#):
>
> a volume of autoclose issue.

We’ve had (that I can see) 4 topics autoclose today.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 3, 2015, 12:54am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/4 "2015-02-03T00:54:33Z")

</div>

I think something bad is happening on your instance unrelated to this. trying to debug again now.

---

<div class="post-metadata">

### Author: ![Kuro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuro/32/38491_2.png) [@Kuro](https://meta.discourse.org/u/Kuro)
#### Post date: [February 3, 2015, 12:57am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/5 "2015-02-03T00:57:09Z")

</div>

Let me rephrase that a bit:

Today we had multiple occasions of 504-errors with varying length over at our instance of Discourse. We noticed that every time the errors occured a topic had been closed (and sometimes people tried to write in said closed topic).  
So we came to the conclusion that the closure of topics was probably the thing causing the problem.  
We would appreciate if some dev could check any logs and either verify or deny our suspicion.

Thanks in advance,

TDWTF

**Addendum:** Now @Sam has already replied and seems to checking things out. I will post this regardless as phrasing it took effort

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 3, 2015, 1:07am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/6 "2015-02-03T01:07:06Z")

</div>

This is super odd @codinghorror we are also seeing this on BBS and bbs has the “auto closure” in common with WTF.

I am going to dig in to this code now.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 3, 2015, 5:02am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/7 "2015-02-03T05:02:12Z")

</div>

This particular issue with auto close is now fixed:

[https://github.com/discourse/discourse/commit/7e259375e993d7c17b41e949d8a8668be0ada12f](https://github.com/discourse/discourse/commit/7e259375e993d7c17b41e949d8a8668be0ada12f)

Leaving this open while I investigate if I can speed up the global consistency check

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 3, 2015, 5:15am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/8 "2015-02-03T05:15:20Z")

</div>

Closing as TopicUser.ensure\_consistncy never fires outside of pretend\_read, ensure\_db\_consistency is skipping it.

I still want to speed it up, but this issue is fixed

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 3, 2015, 5:15am UTC](https://meta.discourse.org/t/autoclosing-topic-causes-50x-errors/24751/9 "2015-02-03T05:15:27Z")

</div>


