"500 Internal Server Error" when approving a post in review

Hi,

I’m using the 2.5.1 version of Discourse and get a “500 Internal Server Error” when approving a post in review.

Here is the error in /logs:

Message (7 copies reported)

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'

Backtrace

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 Like

We are experiencing the same issue in the same circumnstances as described by Camille.

So we tried to edit the post first, and then tried again to approve it, but the problem persist.

Any solution available?

Thank you

1 Like

I’m still having the same problem with the v2.5.2 +2 version.
It seems to happen to the posts triggering the auto silence fast typers on first post option.

Hi @CamilleRoux!

I couldn’t reproduce this locally so maybe I’m missing something. Does this happen when you try to approve any queued post, or only for a particular one?

I’ve no other message in review… What can I do to give you more info?

I just set approve new topics unless trust level the max and now I get a 500 error when I post a new topic. It seems to be quite the same error:

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'

Backtrace

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'

Can you enter the container and check the PostgreSQL logs for an error around the same timestamp?

2 Likes

Here is the error (for the error of the topic):

2020-10-01 18:37:18.894 UTC [25661] discourse@discourse ERROR:  null value in column "private_message" violates not-null constraint
2020-10-01 18:37:18.894 UTC [25661] discourse@discourse DETAIL:  Failing row contains (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:  current transaction is aborted, commands ignored until end of transaction block
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:  current transaction is aborted, commands ignored until end of transaction block
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 Like

Thanks, that really helps!

Did you were tracking the beta branch at some point and then switched to stable? The private_message column was added in v2.6.0.beta2, but the commit is not included in v2.5.2 +2. This is the commit:

https://github.com/discourse/discourse/commit/92b7fe4c62094275c5dd09b1f3dac5c5cbcad1c0

1 Like

Arf… Yes I did that, my bad. Thank you very much!

Do you know if the next stable version will be release soon?

That is completely unsupported and will result in a broken Discourse. Revert back to the default tests-passed or beta ASAP.

We cut a “stable” version approximately every 6 months, the next one is tracked on Discourse Version 2.6

1 Like

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