尝试编辑带有图片的帖子时出错(NginX Proxy Manager?)

在 2.9.0.beta4 中编辑帖子后,保存帖子时出现错误。该错误为 500 错误,从表面上看,它似乎无法保存草稿。在此版本中,我之前遇到了一些文件所有权错误。有人能告诉我帖子和草稿的存储路径,以便我检查所有权和保护吗?

这似乎是一个过于简单的答案,因此如果我判断失误,我先致歉,但如果您使用的是 https://meta.discourse.org/t/data-explorer-plugin/32566,那么帖子就在 posts 表中,草稿就在 drafts 表中。

您的浏览器控制台中是否有错误可以提供更多关于什么不起作用的细节?

我没有使用 Explorer Plugin。编辑带有内嵌图形的文档时似乎会出现这种情况。也许存储它们的文件夹的保护设置不正确?您知道它在哪里吗?

1 个赞

正如 @JammyDodger 所提到的,绝大多数 Discourse 数据都存储在 postgres 数据库中,因此不太可能出现仅影响某些 Discourse 功能的“文件所有权”问题。

在标准安装中,上传文件存储在 /var/discourse/shared/standalone/... 下。然后该目录会被挂载到 docker 容器内部。那里的权限可能存在问题 :+1:

可以确定的是,500 错误的根本原因应该可以在您站点的错误日志中找到。以管理员身份登录后,访问 /logs 并查找最近的红色错误。

4 个赞

我有一个标准的安装,是从网站上执行的。在容器内,/var 不包含 ./discourse。但它包含 ./www。/var/www/discourse 确实存在。里面的所有东西都归 discourse 所有,没有 shared 或 standalone 文件夹。

容器外有一个 /var/discourse/shared/standalone 文件夹。由于是 docker 安装,容器外没有 docker。

1 个赞

^^ 错误日志中有任何可见的内容吗?

我没有 /logs。有一个 /var/discourse/shared/standalone/log/var-log 文件夹,还有一个 /var/log 文件夹。这两个文件夹都包含大量的 .gz 文件。

以管理员身份登录后,您应该可以在浏览器中访问 https://{your forum}}/logs

谢谢!我之前不知道。我刚编辑帖子时触发了 500 错误,然后查看了日志:


在我点击保存的那一刻就触发了错误。

能否复制粘贴“info”选项卡和“backtrace”选项卡的所有内容?(backtrace 最有用的部分是顶部,在截图中被截断了)

在编辑现有帖子触发 500 错误后,这是信息选项卡。

你好 @vmsman :slightly_smiling_face: 你怎么样?

如果可以的话,能否请你在 Meta 上将完整的“info”和“backtrace”复制并粘贴到代码块中,以便我们查看所有重要部分?

这是我测试站点上一个不同错误的示例:

Message (35 copies reported)

Failed to warm up pretty text: JavaScript was terminated (either by timeout or explicitly)

Backtrace

lib/discourse.rb:772:in `rescue in after_fork'
lib/discourse.rb:768:in `after_fork'
/var/www/discourse/lib/demon/base.rb:217:in `establish_app'
/var/www/discourse/lib/demon/base.rb:147:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:10:in `block in fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:8:in `fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:8:in `fork'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.4.7/lib/active_support/fork_tracker.rb:27:in `fork'
/var/www/discourse/lib/demon/base.rb:144:in `run'
/var/www/discourse/lib/demon/base.rb:140:in `start'

I found something significant. When I edit an existing post I see a message in red indicating that drafts are offline.

Hopefully this is what you need. The 500 error appears to generate a #<Net::OpenTimeout: execution expired>

/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `initialize'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `open'
/usr/local/lib/ruby/2.7.0/net/http.rb:960:in `block in connect'
/usr/local/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
/usr/local/lib/ruby/2.7.0/net/http.rb:958:in `connect'
/usr/local/lib/ruby/2.7.0/net/http.rb:943:in `do_start'
/usr/local/lib/ruby/2.7.0/net/http.rb:932:in `start'
/usr/local/lib/ruby/2.7.0/net/http.rb:606:in `start'
/var/www/discourse/lib/final_destination.rb:515:in `safe_session'
/var/www/discourse/lib/final_destination.rb:455:in `safe_get'
/var/www/discourse/lib/final_destination.rb:147:in `get'
/var/www/discourse/lib/retrieve_title.rb:63:in `fetch_title'
/var/www/discourse/lib/retrieve_title.rb:7:in `crawl'
/var/www/discourse/app/jobs/regular/crawl_topic_link.rb:39:in `execute'
/var/www/discourse/app/jobs/base.rb:232:in `block (2 levels) in perform'
rails_multisite-4.0.1/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/app/jobs/base.rb:221:in `block in perform'
/var/www/discourse/app/jobs/base.rb:217:in `each'
/var/www/discourse/app/jobs/base.rb:217:in `perform'
sidekiq-6.4.1/lib/sidekiq/processor.rb:196:in `execute_job'
sidekiq-6.4.1/lib/sidekiq/processor.rb:164:in `block (2 levels) in process'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:138:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:138:in `call'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
sidekiq-6.4.1/lib/sidekiq/middleware/chain.rb:143:in `invoke'
sidekiq-6.4.1/lib/sidekiq/processor.rb:163:in `block in process'
sidekiq-6.4.1/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_retry.rb:114:in `local'
sidekiq-6.4.1/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq.rb:40:in `block in <module:Sidekiq>'
sidekiq-6.4.1/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/processor.rb:257:in `stats'
sidekiq-6.4.1/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_logger.rb:13:in `call'
sidekiq-6.4.1/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_retry.rb:81:in `global'
sidekiq-6.4.1/lib/sidekiq/processor.rb:124:in `block in dispatch'
sidekiq-6.4.1/lib/sidekiq/job_logger.rb:39:in `prepare'
sidekiq-6.4.1/lib/sidekiq/processor.rb:123:in `dispatch'
sidekiq-6.4.1/lib/sidekiq/processor.rb:162:in `process'
sidekiq-6.4.1/lib/sidekiq/processor.rb:78:in `process_one'
sidekiq-6.4.1/lib/sidekiq/processor.rb:68:in `run'
sidekiq-6.4.1/lib/sidekiq/util.rb:56:in `watchdog'
sidekiq-6.4.1/lib/sidekiq/util.rb:65:in `block in safe_thread'

I am also seeing a ActionView::Template::Error (undefined method `stylesheet_path’ for #Stylesheet::Manager::Builder:0x00007f27b6c2f850 Did you mean? stylesheet_relpath stylesheet_fullpath) lib/stylesh

lib/stylesheet/manager.rb:246:in `block in stylesheet_details'
lib/stylesheet/manager.rb:215:in `synchronize'
lib/stylesheet/manager.rb:215:in `stylesheet_details'
lib/stylesheet/manager.rb:192:in `stylesheet_link_tag'
app/helpers/application_helper.rb:565:in `discourse_stylesheet_link_tag'
app/views/layouts/crawler.html.erb:11
actionview (6.1.4.1) lib/action_view/base.rb:247:in `public_send'
actionview (6.1.4.1) lib/action_view/base.rb:247:in `_run'
actionview (6.1.4.1) lib/action_view/template.rb:154:in `block in render'
activesupport (6.1.4.1) lib/active_support/notifications.rb:205:in `instrument'
actionview (6.1.4.1) lib/action_view/template.rb:345:in `instrument_render_template'
actionview (6.1.4.1) lib/action_view/template.rb:152:in `render'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:72:in `block in render_with_layout'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:55:in `render_template'
actionview (6.1.4.1) lib/action_view/renderer/template_renderer.rb:11:in `render'
actionview (6.1.4.1) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
actionview (6.1.4.1) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
actionview (6.1.4.1) lib/action_view/rendering.rb:117:in `block in _render_template'
actionview (6.1.4.1) lib/action_view/base.rb:273:in `in_rendering_context'
actionview (6.1.4.1) lib/action_view/rendering.rb:116:in `_render_template'
actionpack (6.1.4.1) lib/action_controller/metal/streaming.rb:218:in `_render_template'
actionview (6.1.4.1) lib/action_view/rendering.rb:103:in `render_to_body'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (6.1.4.1) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (6.1.4.1) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
/usr/local/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
activesupport (6.1.4.1) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:46:in `block in render'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:45:in `render'
lib/topic_list_responder.rb:13:in `block (2 levels) in respond_with_list'
actionpack (6.1.4.1) lib/action_controller/metal/mime_responds.rb:214:in `respond_to'
lib/topic_list_responder.rb:9:in `respond_with_list'
app/controllers/list_controller.rb:103:in `block (2 levels) in <class:ListController>'
actionpack (6.1.4.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
app/controllers/application_controller.rb:387:in `block in with_resolved_locale'
i18n (1.9.1) lib/i18n.rb:328:in `with_locale'
app/controllers/application_controller.rb:387:in `with_resolved_locale'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4.1) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4.1) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4.1) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4.1) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4.1) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4.1) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4.1) lib/action_view/rendering.rb:39:in `process'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiling_methods.rb:85:in `block in profile_method'
actionpack (6.1.4.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4.1) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (6.1.4.1) lib/action_dispatch/routing/mapper.rb:49:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4.1) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4.1) lib/action_dispatch/routing/route_set.rb:842:in `call'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.4.1) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:354:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/cookies.rb:689:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call'
railties (6.1.4.1) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4.1) lib/rails/rack/logger.rb:28:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/request_id.rb:26:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4.1) lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
rack-mini-profiler (2.3.3) lib/mini_profiler/profiler.rb:249:in `call'
message_bus (4.0.0) lib/message_bus/rack/middleware.rb:60:in `call'
lib/middleware/request_tracker.rb:198:in `call'
railties (6.1.4.1) lib/rails/engine.rb:539:in `call'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `public_send'
railties (6.1.4.1) lib/rails/railtie.rb:207:in `method_missing'
rack (2.2.3) lib/rack/urlmap.rb:74:in `block in call'
rack (2.2.3) lib/rack/urlmap.rb:58:in `each'
rack (2.2.3) lib/rack/urlmap.rb:58:in `call'
unicorn (6.1.0) lib/unicorn/http_server.rb:634:in `process_client'
unicorn (6.1.0) lib/unicorn/http_server.rb:739:in `worker_loop'
unicorn (6.1.0) lib/unicorn/http_server.rb:547:in `spawn_missing'

原来我没注意到,但似乎我现在无法上传任何图片。在新帖子中上传图片的任何尝试都会导致“抱歉,上传文件时出错。请重试。”。所以,显然我无法编辑和保存旧帖子中的任何内容,否则会出现 500 错误,并且如果新帖子不是纯文本,我也无法创建。所以,我可以创建和删除纯文本帖子。因此,我认为问题已经缩小到任何包含图形的新旧帖子的某种错误。在这些测试中,我是管理员用户。

因此,在完全沮丧的情况下,我决定尝试重建。我看到的第一个错误是:

I, [2022-04-29T00:19:51.497560 #1]  INFO -- : cd /var/www/discourse & [ ! -d 'node_modules' ] || su discourse -c 'yarn install --production & yarn cache clean'
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
warning Cannot find a suitable global folder. Tried these: "/usr/local, /home/discourse/.yarn"
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".

这些是奇怪的错误,因为我将 /home/discourse 设置为 777,但仍然收到这些错误。
直到最后才出现其他错误:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 716 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
451d4b5ee8d036df6ab8f7717019d94b66d10d261c3d1201547dad7a1722a544
==================== END REBUILD LOG ====================
Failed to rebuild app.

无论如何,在运行 ./discourse-doctor 后,我能够发布带有图形的内容并再次编辑带有图形的帖子,直到我重新启动,现在我又遇到了同样的错误。

我认为也许我们应该从基础开始:

  • 这是标准安装吗?
  • 您是否安装了任何插件或自定义主题?
  • 当您重建时,输出中的错误是什么(例如,在最后,当它要求您向上滚动以获取更具体的错误时,您看到什么错误/可以将其全部复制到此处的代码块中以便我们查看)
  • discourse-doctor 做了/建议了哪些更改,以及您为了“重新启动”实例而使其停止工作的更改是什么?

这是一个标准安装。它已经存在大约 2 年了。
我没有使用任何插件或自定义主题。
我粘贴了重建过程中遇到的所有错误。
最开始的错误是:

I, [2022-04-29T00:19:51.497560 #1]  INFO -- : cd /var/www/discourse & [ ! -d 'node_modules' ] || su discourse -c 'yarn install --production & yarn cache clean'
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
warning Cannot find a suitable global folder. Tried these: "/usr/local, /home/discourse/.yarn"
warning Skipping preferred cache folder "/home/discourse/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".

Discourse-doctor 建议不进行任何更改,并且似乎运行正常。

我不知道 500 错误是什么时候开始的,这与我无法保存带有图片的草稿或帖子是同一时间。请访问我的论坛:https://discussion.scottibyte.com 亲身体验。在上面的帖子中,我包含了重建和 discourse-doctor 过程中看到的绝对所有错误。

我可以告诉你,在我运行:

./discourse-setup rebuild

之后,实例会像上面看到的那样启动失败。如果我运行:

./discourse-doctor

之后,实例不知何故至少启动了,但我遇到了同样的错误。
我喜欢这个产品,但它似乎每隔几个月就会出现一些随机的、难以修复的错误。我的安装绝对是标准的,没有任何修改,它只是随机出现故障。

1 个赞

您的磁盘已满?不过,我想您应该会收到警告。

我稍后会重新上线,但只是快速检查一下,这是拼写错误吗?

命令应该是:

./launcher rebuild app

不,这不是拼写错误。我好像用错了命令。我现在就试试。