요즘 아주 고약한 버그에 막혀서 저희 웹사이트 전체가 깨져 버렸는데, 해결책이 보이지 않습니다. 재구축부터 플러그인 제거/추가까지 모든 방법을 시도해 보았지만 소용이 없었습니다. 몇 달 전의 정상 작동하던 백업은 있지만, 더 최신 버전으로 이를 재구축하려고 하면 사이트가 그냥 깨져 버리는 것 같습니다.
표시되는 주요 메시지는 다음과 같습니다:
Oops
The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.
Detailed information about the error was logged, and an automatic notification generated. We'll take a look at it.
No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site's feedback category.
이것은 디스코urses의 일반적인 오류 메시지이며, 문제 해결 시 실질적인 결과를 제공하지 않습니다. 도커 로그를 확인해 보니 다음 내용이 발견되었습니다:
Completed 500 Internal Server Error in 152ms (ActiveRecord: 0.0ms | Allocations: 17980)
ActionView::Template::Error (undefined method `[]' for nil:NilClass)
lib/svg_sprite/svg_sprite.rb:502:in `block in custom_icons'
lib/svg_sprite/svg_sprite.rb:500:in `each'
lib/svg_sprite/svg_sprite.rb:500:in `custom_icons'
lib/svg_sprite/svg_sprite.rb:275:in `block in all_icons'
lib/distributed_cache.rb:25:in `defer_get_set'
lib/svg_sprite/svg_sprite.rb:517:in `get_set_cache'
lib/svg_sprite/svg_sprite.rb:268:in `all_icons'
lib/svg_sprite/svg_sprite.rb:337:in `bundle'
lib/svg_sprite/svg_sprite.rb:285:in `block in version'
lib/distributed_cache.rb:25:in `defer_get_set'
lib/svg_sprite/svg_sprite.rb:517:in `get_set_cache'
lib/svg_sprite/svg_sprite.rb:284:in `version'
lib/svg_sprite/svg_sprite.rb:290:in `path'
app/helpers/application_helper.rb:586:in `client_side_setup_data'
app/views/layouts/application.html.erb:61
lib/topic_list_responder.rb:13:in `block (2 levels) in respond_with_list'
lib/topic_list_responder.rb:9:in `respond_with_list'
app/controllers/list_controller.rb:103:in `block (2 levels) in <class:ListController>'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
app/controllers/application_controller.rb:387: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:198:in `call'
그래서 당연히, 오류가 발생하는 501번째 줄에 try/catch를 구현하면 문제를 해결할 수 있을 것이라 생각했습니다. 해당 메서드는 다음과 같습니다:
def self.custom_icons(theme_id)
# Automatically register icons in sprites added via themes or plugins
icons = []
custom_svg_sprites(theme_id).each do |item|
begin
svg_file = Nokogiri::XML(item[:sprite])
svg_file.css('symbol').each do |sym|
icons << sym.attributes['id'].value if sym.attributes['id'].present?
end
rescue Exception:
puts Exception
end
end
icons
end
이 방법은 사이트의 기능을 실제로 복원하지만, 불행히도 웹사이트 전체에서 아이콘이나 이미지가 로드되지 않도록 함으로써 복원되므로, 결국 아무것도 해결하지 못합니다.
저희가 사용 중인 플러그인은 다음과 같습니다:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/discourse-bbcode.git
- git clone https://github.com/discourse/discourse-follow.git
- git clone https://github.com/discourse/discourse-user-notes.git
기억이 맞다면, discourse-follow와 같은 일부 플러그인은 공식적으로 지원되기 전에 사용했었습니다. 따라서 사이드그레이딩(sidegrading) 과정에서 무언가가 깨진 것일 수도 있습니다.
업데이트 전 원래 버전은 2.8.0.beta2였으며, 현재는 2.9.0.beta1을 사용 중입니다.
생각할 수 있는 거의 모든 방법을 시도해 보았지만, 이 버그가 너무 일반적이어서 누군가가 도움을 줄 수 있을지 확신이 서지 않아 여기에 게시해야 할지 고민되었습니다. 하지만 이 문제를 일으키는 원인에 대해 아이디어가 있으시다면 도움을 주시면 감사하겠습니다.
