审核帖子时出现“500内部服务器错误”

你好,

我正在使用 Discourse 2.5.1 版本,在审核中批准帖子时出现“500 内部服务器错误”。

以下是 /logs 中的错误信息:

消息(已报告 7 次)

ActiveRecord::StatementInvalid (PG::InFailedSqlTransaction: 错误:当前事务已中止,在事务块结束前将忽略所有命令
)
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'

回溯

rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'
rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
activesupport-6.0.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:673:in `exec_no_cache'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:654:in `execute_and_clear'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:111:in `exec_delete'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:180:in `delete'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `delete'
activerecord-6.0.3.1/lib/active_record/relation.rb:587:in `delete_all'
/var/www/discourse/app/models/topic_link.rb:376:in `cleanup_entries'
/var/www/discourse/app/models/topic_link.rb:139:in `extract_from'
/var/www/discourse/lib/post_creator.rb:576:in `extract_links'
/var/www/discourse/lib/post_creator.rb:180:in `block in create'
/var/www/discourse/lib/post_creator.rb:359:in `block in transaction'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
activerecord-6.0.3.1/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/lib/post_creator.rb:358:in `transaction'
/var/www/discourse/lib/post_creator.rb:174:in `create'
/var/www/discourse/app/models/reviewable_queued_post.rb:80:in `perform_approve_post'
/var/www/discourse/app/models/reviewable.rb:355:in `public_send'
/var/www/discourse/app/models/reviewable.rb:355:in `block in perform'
1 个赞

我们在与 Camille 描述相同的情况下遇到了同样的问题。

因此,我们尝试先编辑帖子,然后再尝试批准它,但问题依然存在。

是否有可用的解决方案?

谢谢

1 个赞

我在使用 v2.5.2 +2 版本时仍然遇到同样的问题。
这似乎发生在触发了“在首帖时自动静音快速打字者”选项的帖子。

你好 @CamilleRoux

我在本地无法复现此问题,所以可能我漏掉了什么。这是在你尝试批准任何排队中的帖子时发生,还是仅针对某个特定帖子?

我这边没有其他待审核的消息了……我能提供哪些更多信息?

我刚刚将“除非信任级别”设置为“批准新主题”的最大值,现在发布新主题时出现 500 错误。看起来是同样的错误:

ActiveRecord::StatementInvalid (PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
)
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'

回溯

rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'
rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:72:in `exec_params'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
activesupport-6.0.3.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
activesupport-6.0.3.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
activerecord-6.0.3.1/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
activerecord-6.0.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
activesupport-6.0.3.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

能否进入容器,检查同一时间戳附近的 PostgreSQL 日志以查找错误?

2 个赞

这是错误信息(关于主题的错误):

2020-10-01 18:37:18.894 UTC [25661] discourse@discourse ERROR:  列 "private_message" 中的空值违反了非空约束
2020-10-01 18:37:18.894 UTC [25661] discourse@discourse DETAIL:  失败的行包含 (8803, 'a':25 'api':4A,17 'arriv':23 'avanc':48 'bas':14 'cod':54 'comm..., Comment obtenir l'API odoo sur React Native? Developpement J'u..., fr, 3, null)。
2020-10-01 18:37:18.894 UTC [25661] discourse@discourse STATEMENT:  INSERT INTO post_search_data
	(post_id, search_data, locale, raw_data, version)
	VALUES (8803, setweight(to_tsvector('french', coalesce('Comment obtenir l''API odoo sur React Native?','')), 'A') ||
	setweight(to_tsvector('french', coalesce('Developpement','')), 'B') ||
	setweight(to_tsvector('french', coalesce('','')), 'C') ||
	setweight(to_tsvector('french', coalesce('J’utilise Odoo comme base de donnees API sur react native mais j’arrive pas a me connecter, j’ai utilise le package npm react-native-odoo , vous pouvez voir mon erreur sur l’image. Merci d’avance pour vos reponses Voici mon Code oddo et l’erreur que j’obtiens error','')), 'D')
	, 'fr', 'Comment obtenir l''API odoo sur React Native? Developpement J’utilise Odoo comme base de donnees API sur react native mais j’arrive pas a me connecter, j’ai utilise le package npm react-native-odoo , vous pouvez voir mon erreur sur l’image. Merci d’avance pour vos reponses Voici mon Code oddo et l’erreur que j’obtiens error', 3)

2020-10-01 18:37:18.897 UTC [25661] discourse@discourse ERROR:  当前事务已中止,在事务块结束前将忽略所有命令
2020-10-01 18:37:18.897 UTC [25661] discourse@discourse STATEMENT:  UPDATE topic_search_data
	SET
	   raw_data = 'Comment obtenir l''API odoo sur React Native? J’utilise Odoo comme base de donnees API sur react native mais j’arrive pas a me connecter, j’ai utilise le package npm react-native-odoo , vous pouvez voir mon erreur sur l’image. Merci d’avance pour',
	   locale = 'fr',
	   search_data = setweight(to_tsvector('french', coalesce('Comment obtenir l''API odoo sur React Native?','')), 'A') ||
	setweight(to_tsvector('french', coalesce('J’utilise Odoo comme base de donnees API sur react native mais j’arrive pas a me connecter, j’ai utilise le package npm react-native-odoo , vous pouvez voir mon erreur sur l’image. Merci d’avance pour','')), 'B') ||
	setweight(to_tsvector('french', coalesce(NULL,'')), 'C') ||
	setweight(to_tsvector('french', coalesce(NULL,'')), 'D')
	,
	   version = 3
	WHERE topic_id = 4351

2020-10-01 18:37:18.900 UTC [25661] discourse@discourse ERROR:  当前事务已中止,在事务块结束前将忽略所有命令
2020-10-01 18:37:18.900 UTC [25661] discourse@discourse STATEMENT:  DELETE FROM "topic_links" WHERE ((post_id = 8803 AND NOT reflection) OR (link_post_id = 8803 AND reflection))
1 个赞

谢谢,这真的很有帮助!

你之前是否跟踪过 beta 分支,然后切换到了 stableprivate_message 列是在 v2.6.0.beta2 中新增的,但该提交并未包含在 v2.5.2 +2 中。这是该提交的链接:

1 个赞

阿夫……是的,是我做的,我的错。非常感谢!

你知道下一个稳定版本会很快发布吗?

这完全不受支持,会导致 Discourse 无法正常运行。请尽快恢复为默认的 tests-passedbeta

我们大约每 6 个月发布一个“稳定”版本,下一个版本正在 Discourse Version 2.6 中跟踪。

1 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.