Earlier today, I created a support topic in this context, but I wasn’t sure so I did some more tries and investigation into this, Seems like something is very wrong here. multisite rebuilds fail with this error:
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate failed with return #<Process::Status: pid 5780 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate"
606e95cb68c244f04807369e0f1f677f54e745905f3c59436d0540e162692184
** 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.
Trying to run rake multisite:migrate
inside the web_only container on an existing site renders the following error:
root@discourse-web-only:/var/www/discourse# rake multisite:migrate
Multisite migrator is running using 20 threads
Migrating secondsite
#<Thread:0x000055b1bd94f308@/var/www/discourse/lib/tasks/db.rake:127 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
9: from /var/www/discourse/lib/tasks/db.rake:132:in `block (2 levels) in execute_concurently'
8: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:65:in `with_connection'
7: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:286:in `with_connection'
6: from /var/www/discourse/lib/tasks/db.rake:134:in `block (3 levels) in execute_concurently'
5: from /var/www/discourse/lib/tasks/db.rake:156:in `block (2 levels) in <main>'
4: from /var/www/discourse/lib/site_icon_manager.rb:24:in `ensure_optimized!'
3: from /var/www/discourse/lib/site_icon_manager.rb:24:in `each'
2: from /var/www/discourse/lib/site_icon_manager.rb:25:in `block in ensure_optimized!'
1: from /var/www/discourse/lib/site_icon_manager.rb:73:in `resolve_original'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/core.rb:177:in `find': Couldn't find Upload with 'id'=-6 (ActiveRecord::RecordNotFound)
4: from /var/www/discourse/lib/tasks/db.rake:132:in `block (2 levels) in execute_concurently'
3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:65:in `with_connection'
2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:286:in `with_connection'
1: from /var/www/discourse/lib/tasks/db.rake:135:in `block (3 levels) in execute_concurently'
/var/www/discourse/lib/tasks/db.rake:136:in `rescue in block (3 levels) in execute_concurently': undefined local variable or method `exceptions' for main:Object (NameError)
rake aborted!
NameError: undefined local variable or method `exceptions' for main:Object
/var/www/discourse/lib/tasks/db.rake:136:in `rescue in block (3 levels) in execute_concurently'
/var/www/discourse/lib/tasks/db.rake:135:in `block (3 levels) in execute_concurently'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:286:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:65:in `with_connection'
/var/www/discourse/lib/tasks/db.rake:132:in `block (2 levels) in execute_concurently'
Caused by:
ActiveRecord::RecordNotFound: Couldn't find Upload with 'id'=-6
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/core.rb:177:in `find'
/var/www/discourse/lib/site_icon_manager.rb:73:in `resolve_original'
/var/www/discourse/lib/site_icon_manager.rb:25:in `block in ensure_optimized!'
/var/www/discourse/lib/site_icon_manager.rb:24:in `each'
/var/www/discourse/lib/site_icon_manager.rb:24:in `ensure_optimized!'
/var/www/discourse/lib/tasks/db.rake:156:in `block (2 levels) in <main>'
/var/www/discourse/lib/tasks/db.rake:134:in `block (3 levels) in execute_concurently'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:286:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.3.0/lib/rails_multisite/connection_management.rb:65:in `with_connection'
/var/www/discourse/lib/tasks/db.rake:132:in `block (2 levels) in execute_concurently'
Migrating default
Tasks: TOP => multisite:migrate
(See full trace by running task with --trace)
Migrating thirdsite
== 20200611104600 CreateMissingBadgeIndexes: migrating ========================
-- execute("CREATE INDEX IF NOT EXISTS index_user_badges_on_user_id ON public.user_badges USING btree (user_id)")
-> 0.0403s
-- execute("CREATE INDEX IF NOT EXISTS index_badges_on_badge_type_id ON public.badges USING btree (badge_type_id)")
-> 0.0024s
== 20200611104600 CreateMissingBadgeIndexes: migrated (0.0477s) ===============
== 20200617144300 AddPublicFieldToPublishedPages: migrating ===================
-- execute("DELETE FROM schema_migrations WHERE version='20201006172700'\n")
-> 0.0078s
-- execute("DELETE FROM schema_migrations WHERE version='20201006172701'\n")
-> 0.0020s
-- execute("ALTER TABLE \"published_pages\" ADD COLUMN IF NOT EXISTS \"public\" boolean DEFAULT FALSE NOT NULL\n")
-> 0.0262s
== 20200617144300 AddPublicFieldToPublishedPages: migrated (0.0383s) ==========
it is the same error where it reports upload with id -6 is missing. I’ve got this issue on at least 3 test instances on different providers so I’m pretty confident in calling this as a bug but please correct me if i’m wrong.