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?
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:
Maybe we defer the update_statistics work to sidekiq?
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.
Thank you for your hard work!
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?
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:
نواجه أيضًا أخطاء 502 عند نقل المشاركات.
كان هذا يحدث بشكل متقطع في السابق، وكان الإصرار عادةً ما ينجح. ولكن الآن لدينا حالة فشل مستمر عند محاولة نقل مشاركة واحدة إلى موضوع طويل نسبيًا (2000 مشاركة)، وينتهي الوقت بعد حوالي 30 ثانية.
الخادم ليس مشغولًا بشكل خاص عندما يحدث هذا ويتعامل بشكل جيد مع بقية النشاط. محاولة نقل المشاركة عندما يكون النشاط منخفضًا تؤدي إلى نفس النتيجة. لا يوجد فرق مع الوضع الآمن.
بخلاف تعزيز الخادم (بافتراض أن هذا أحد الحلول؟)، هل هناك أي شيء آخر يمكننا تجربته؟ يسعدنا تقديم المزيد من المعلومات إذا كانت مفيدة. تجدر الإشارة إلى أنني أستخدم أحدث إصدار مستقر - سأفكر في التبديل إلى أحدث إصدار تجريبي إذا كانت هناك تغييرات حديثة لهذا الغرض.
خلال عطلة نهاية الأسبوع (وهي أبطأ فترة لدينا) قمنا بزيادة سعة التخزين القصوى لعمليات الإدخال/الإخراج في الثانية ثلاث مرات، ثم قمنا أيضًا بزيادة الإنتاجية القصوى ثلاث مرات، ومع ذلك لم نتمكن من نقل منشور واحد إلى الموضوع الحالي الذي يحتوي على 2000 منشور.
لا يبدو أن ترك رد جديد على الموضوع نفسه يمثل مشكلة، لذا أعتقد أنه يجب أن يكون هناك الكثير من العمل الإضافي متضمنًا عند نقل المنشور من مكان ما، بدلاً من إنشائه من جديد. إذا لم يكن من الممكن إنجازه في أقل من 30 ثانية، فربما يجب أن يتم ذلك عبر مهمة في الخلفية بدلاً من الفشل برسالة “خطأ 502”؟
نعم، يحدث لي ذلك أيضًا في المواضيع القديمة والطويلة التي يزيد عدد مشاركاتها عن 3000 مشاركة.
لا يزال الأمر مؤلمًا.
مرحباً
أواجه مشكلة مشابهة حيث لا يمكنني دمج موضوع مع جميع ردوده في منشور موضوع آخر. الموضوع الذي أدمج إليه يحتوي على 23 منشورًا والموضوع الذي أنقل منه يحتوي على 4 منشورات فقط.
|سجل الأخطاء
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'
ملاحظة: لاحظت أن الخطأ يقول already exists ولكن في الواقع هما موضوعان منفصلان. لا أعرف ما إذا كان هذا مرتبطًا، ولكن قبل ظهور هذا الخطأ، قمت بنقل عدة مواضيع ومنشوراتها إلى الموضوع الذي يحتوي على 23 منشورًا والذي أحاول دمج هذا الموضوع فيه (كما فعلت مع المواضيع الأخرى).
شكراً!
هل قمت بالتحديث في الأيام القليلة الماضية؟ كان هناك إصلاح حديث يتعلق بنقل المنشورات


