I post di spostamento restituiscono 502 Bad Gateway

10 posts were merged into an existing topic: 502 errors when splitting topic, moving or renaming categories

This most annoying bug is still with us.
Could you give me instructions to nail the problem?

1 Mi Piace

Unfortunately we are still running into this issue from time to time. I managed to collect some data about a recent problem where moving 27 posts into an existing topic (2013 posts) failed:

Beginning move at 2021-05-25 20:54:57 +0000
create_temp_table
  0.000134   0.000027   0.000161 (  0.002810)

delete_invalid_post_timings
  0.000317   0.000065   0.000382 (  0.306869)

move_incoming_emails
  0.000056   0.000006   0.000062 (  0.000478)

move_notifications
  0.000074   0.000008   0.000082 (  0.005584)

update_reply_counts
  0.000088   0.000010   0.000098 (  0.001058)

update_quotes
  0.000079   0.000008   0.000087 (  0.002426)

move_first_post_replies
  0.000071   0.000008   0.000079 (  0.000695)

delete_post_replies
  0.000062   0.000006   0.000068 (  0.000834)

copy_first_post_timings
  0.000064   0.000007   0.000071 (  0.002660)

move_post_timings
  0.000082   0.000009   0.000091 (  0.008195)

copy_topic_users
  0.000398   0.000043   0.000441 (  0.043640)

move_each_post
  4.345220   0.132652   4.477872 (  3.447047)

create_moderator_post_in_original_topic
  0.163962   0.000253   0.164215 (  0.207101)

update_statistics
  0.217266   0.051660   0.268926 ( 45.258070)

update_user_actions
  0.000934   0.000101   0.001035 (  0.178894)

update_last_post_stats
  0.001589   0.000171   0.001760 (  0.003156)

update_upload_security_status
  0.000030   0.000003   0.000033 (  0.000034)

update_bookmarks
  0.000492   0.000054   0.000546 (  0.003832)

Finished move at 2021-05-25 20:55:47 +0000

Most methods finish real quick, but update_statistics took over 45 seconds in this case. All that time is spent on the following method call:

9 Mi Piace

Maybe we defer the update_statistics work to sidekiq?

1 Mi Piace

Yes, probably. But I’m going to take a hard look at how complicated it would be to move the whole process into a Sidekiq job and let the UI wait until it’s finished. We are kinda playing whac-a-mole here by always moving bits and pieces into jobs.

7 Mi Piace

Thank you for your hard work!

2 Mi Piace

I also get this 502 when trying to merge topics. Not every time, but a lot of the time.

I’m doing this when someone has started a topic on a subject that already exists, so typically I’m trying to move only a very small number of posts (no more than five).

I haven’t read this entire topic, but I’m understanding that this is a known issue that you’re working on and there isn’t anything I can do myself?

3 Mi Piace

I’m also experiencing this issue on our forum. A number of us are unable to edit and/or create new posts. We’re getting the following error message:

1 Mi Piace

Stiamo riscontrando anche errori 502 durante lo spostamento dei post.

In precedenza si verificava solo occasionalmente e l’insistenza di solito funzionava. Ma ora abbiamo un caso in cui fallisce costantemente quando si tenta di spostare un singolo post in un argomento piuttosto lungo (2k post), andando in timeout dopo circa 30 secondi.

Il server non è particolarmente occupato quando ciò accade e gestisce tranquillamente il resto dell’attività. Tentare di spostare il post quando l’attività è bassa produce lo stesso risultato. Nessuna differenza con la modalità sicura.

Oltre a potenziare l’istanza (presumendo che sia una soluzione per questo?), c’è qualcos’altro che potremmo provare? Sono felice di fornire ulteriori informazioni se utili. Vale la pena menzionare che sono sull’ultima versione stabile — prenderei in considerazione il passaggio all’ultima beta se ci sono state modifiche recenti per questo.

2 Mi Piace

Durante il fine settimana (il nostro periodo più lento) abbiamo temporaneamente triplicato il nostro storage max IOPS e poi anche triplicato il max throughput e ancora non riusciamo a spostare un singolo post nell’argomento esistente con 2k post.

Lasciare una nuova risposta sull’argomento stesso non sembra essere un problema, quindi immagino che debba esserci molto più lavoro extra coinvolto quando il post viene spostato da qualche parte, invece di essere creato da zero. Se non può essere fatto in meno di 30 secondi, forse dovrebbe essere fatto tramite un’attività in background invece di fallire con un messaggio di ‘errore 502’?

6 Mi Piace

Sì, succede anche a me per argomenti vecchi e lunghi con più di 3000 post.
È ancora un problema.

3 Mi Piace

Ciao

Sto riscontrando un problema simile in cui non riesco a unire un argomento con tutte le sue risposte in un altro post dell’argomento. L’argomento in cui sto unendo ha 23 post e l’argomento che sto spostando ne ha solo 4.

|

Log errori
Message (4 copies reported)
Failed to process hijacked response correctly : PG::UniqueViolation : ERROR:  duplicate key value violates unique constraint "post_timings_unique"
DETAIL:  Key (topic_id, post_number, user_id)=(62975, 19, 538) already exists.
Backtrace
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/postgres/connection.rb:217:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `block in run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `block in with_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `with_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `run'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:109:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/postgres/connection.rb:196:in `exec'
/var/www/discourse/app/models/post_mover.rb:517:in `move_post_timings'
/var/www/discourse/app/models/post_mover.rb:142:in `handle_moved_references'
/var/www/discourse/app/models/post_mover.rb:112:in `move_posts_to'
/var/www/discourse/app/models/post_mover.rb:35:in `block in to_topic'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:616:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:613:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:361:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/transactions.rb:234:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:415:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_handling.rb:296:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/transactions.rb:233:in `transaction'
/var/www/discourse/app/models/post_mover.rb:35:in `to_topic'
/var/www/discourse/app/models/topic.rb:1308:in `move_posts'
/var/www/discourse/app/controllers/topics_controller.rb:883:in `block in merge_topic'
/var/www/discourse/lib/hijack.rb:64:in `instance_eval'
/var/www/discourse/lib/hijack.rb:64:in `block in hijack'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/promises.rb:911:in `callback_on_resolution'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/promises.rb:797:in `call_callback'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/promises.rb:803:in `call_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/promises.rb:692:in `resolve_with'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/concurrent-ruby-1.3.4/lib/concurrent-ruby/concurrent/promises.rb:1325:in `resolve'
/var/www/discourse/lib/scheduler/defer.rb:125:in `block in do_work'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:119:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'

nota: Ho notato che l’errore dice already exists ma in realtà sono argomenti separati. Non so se sia correlato, ma prima che questo errore apparisse, ho spostato diversi argomenti e i loro post nell’argomento con i 23 post in cui sto cercando di unire questo (come ho fatto con gli altri argomenti).

Grazie!

2 Mi Piace

Hai aggiornato negli ultimi giorni? C’è stata una recente correzione relativa allo spostamento dei post

5 Mi Piace