# 잠긴 토픽의 diff를 열려 할 때 ArgumentError(Attributes per element limit exceeded) 발생

**URL:** https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090
**Category:** Bug
**Created:** [11월 3, 2021, 9:43오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090 "2021-11-03T09:43:40Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 3, 2021, 9:43오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/1 "2021-11-03T09:43:40Z")

</div>

토픽 버전 차이를 보기 위해 “편집” 아이콘을 클릭할 때 ArgumentError (Attributes per element limit exceeded) 발생.

### 개발자 콘솔

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/7/172a0b6a8478ac24bc5563138eeada72394dac66.png)

### 로그

```plaintext
Message (2 copies reported)

ArgumentError (Attributes per element limit exceeded)
lib/discourse_diff.rb:171:in `tokenize_html_blocks'
lib/discourse_diff.rb:10:in `initialize'
app/serializers/post_revision_serializer.rb:117:in `new'
app/serializers/post_revision_serializer.rb:117:in `body_changes'
(eval):18:in `_fast_attributes'
app/controllers/application_controller.rb:520:in `render_json_dump'
app/controllers/posts_controller.rb:408:in `latest_revision'
app/controllers/application_controller.rb:397:in `block in with_resolved_locale'
app/controllers/application_controller.rb:397:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:356:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:187:in `call'

Backtrace

nokogiri-1.12.5-x86_64 (linux) lib/nokogiri/html5/document_fragment.rb:38:in `fragment'
nokogiri-1.12.5-x86_64 (linux) lib/nokogiri/html5/document_fragment.rb:38:in `initialize'
nokogiri-1.12.5-x86_64 (linux) lib/nokogiri/html5/document_fragment.rb:52:in `new'
nokogiri-1.12.5-x86_64 (linux) lib/nokogiri/html5/document_fragment.rb:52:in `parse'
nokogiri-1.12.5-x86_64 (linux) lib/nokogiri/html5.rb:242:in `fragment'
lib/discourse_diff.rb:171:in `tokenize_html_blocks'
lib/discourse_diff.rb:10:in `initialize'
app/serializers/post_revision_serializer.rb:117:in `new'
app/serializers/post_revision_serializer.rb:117:in `body_changes'
(eval):18:in `_fast_attributes'

Env

HTTP HOSTS: jai.community

```

---

<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: [11월 4, 2021, 12:32오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/2 "2021-11-04T00:32:20Z")

</div>

이것이 우리가 여러분을 위해 호스팅하는 사이트에서 발생한 문제인가요? 병리적 행동을 유발하는 diff를 확인해야 합니다.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 4, 2021, 12:46오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/3 "2021-11-04T00:46:32Z")

</div>

자체 호스팅 방식입니다. 차이를 공유하는 가장 좋은 방법은 무엇일까요?

---

<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: [11월 4, 2021, 12:52오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/4 "2021-11-04T00:52:39Z")

</div>

비밀이 없다면, 여기에서 재현해 볼 수 있을까요? 그냥 답변을 게시한 후 10분을 기다렸다가 문제를 수정해 보세요.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 4, 2021, 12:57오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/5 "2021-11-04T00:57:11Z")

</div>

이것은 공개된 커뮤니티가 아니며, 해당 자료는 비공개 베타 제품에 관한 내용입니다. 따라서 자료의 저자와 디스커스(Discourse) 팀에 대한 존중의 의미를 담아, 여기에서 공유하는 것을 자제하겠습니다. 다른 간단한 방법이 있을까요?

---

<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: [11월 4, 2021, 1:43오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/6 "2021-11-04T01:43:21Z")

</div>

분할 정복 전략을 써야 할 것 같습니다. 문제의 원인이 되는 코드를 찾을 때까지 재현 코드를 점점 더 작게 만들어 보세요.

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [11월 4, 2021, 1:51오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/7 "2021-11-04T01:51:19Z")

</div>

메타에서 해당 특정 주제의 내용을 개인 메시지로 보내드릴까요?

---

<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: [11월 4, 2021, 1:53오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/8 "2021-11-04T01:53:34Z")

</div>

자유롭게 해주세요. 특히 재현(repro)이 가능하다면 더 좋습니다.

---

<div class="post-metadata">

### Author: ![copymonopoly](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@copymonopoly](https://meta.discourse.org/u/copymonopoly)
#### Post date: [6월 22, 2026, 12:59오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/9 "2026-06-22T00:59:25Z")

</div>

저도 매우 유사한(또는 관련이 있는) 문제를 경험하고 있습니다.

**재현 방법 / 원인:**

- 이 문제는 **매우 긴 게시글** (약 100,000자)에서 발생합니다.
- 구체적으로 **대규모 수정** (콘텐츠의 상당 부분이 변경될 때)에 의해 발생합니다.

이러한 방대한 편집을 저장하려고 하면 백엔드가 종종 타임아웃(502/504)에 도달합니다. 근본 원인은 구버전과 신버전 간의 **Diff 계산** 이라고 추정하는데, 이 두 조건이 결합되면 비용이 극도로 높아지기 때문입니다.

---

<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: [6월 22, 2026, 8:58오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/10 "2026-06-22T08:58:07Z")

</div>

이 이슈는 해당 토론이 다음 링크에서 계속되고 있으므로 닫겠습니다.

> [@긴 글(약 10만 단어)의 대규모 수정을 저장할 때 Diff 병목으로 인한 백엔드 502/504 타임아웃](https://meta.discourse.org/t/backend-502-504-timeout-when-saving-major-edits-to-long-posts-100k-words-due-to-diff-bottleneck/405773):
>
> 매우 긴 게시글(약 10만 자)을 편집하고 저장할 때 백엔드 타임아웃 문제가 발생했습니다. 저장 작업 중 서버가 응답하지 않아 502/504 에러가 발생합니다. 프론트엔드 콘솔에는 다음과 같은 에러 스택이 표시됩니다: ajax-error.js:36:15 l ajax-error.js:36 u ajax-error.js:75 d ajax-error.js:84 Ember 41 update rest.js:72 update rest.js:72 save rest.js:115 editPost composer.js:1147 Ember 6 몇 가지 비교 테스트를 수행해 보니 병목 현상은 이전 버전과 새 버전 간의 diff 계산에 있는 것으로 보입니다. 긴 게시글 A를 긴 게시글 B로 직접 편집하여 저장하면 일관되게 502/504 타임아웃이 발생합니다. 먼저 긴 게시글을 지우고 짧은 플레이스홀더(예: 5자)를 저장한 뒤, 새로운 전체 내용 B를 붙여넣고 저장하면 빠르게 완료됩니다. 현재 Dif…

---

<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: [6월 22, 2026, 8:59오전 UTC](https://meta.discourse.org/t/argumenterror-attributes-per-element-limit-exceeded-when-trying-to-open-the-diff-of-a-locked-topic/208090/11 "2026-06-22T08:59:36Z")

</div>


