# Multisite:migrate error

**URL:** https://meta.discourse.org/t/multisite-migrate-error/150579
**Category:** Bug
**Created:** [May 6, 2020, 10:40am UTC](https://meta.discourse.org/t/multisite-migrate-error/150579 "2020-05-06T10:40:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 6, 2020, 10:40am UTC](https://meta.discourse.org/t/multisite-migrate-error/150579/1 "2020-05-06T10:40:22Z")

</div>

tests-passed yields an error on `multisite:migrate` for us, in the new concurrency code.

@sam do you have any idea? Seems like this happens when executing external programs and stdout is being flushed implicitly somewhere. Maybe an empty `flush` method would do the job.

EDIT @tgxworld this seems to be caused by [this](https://github.com/discourse/discourse/commit/1062dbc3e9cbf9370803c0acea55eb3c054060ca) commit in the discobot plugin.

Stack trace:

```
#<NoMethodError: undefined method `flush' for #<StdOutDemux:0x000055b719726458>>
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim/cmd.rb:43:in ``'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim/cmd.rb:43:in `capture'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim/config.rb:205:in `processor_count'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim/config.rb:109:in `threads'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim.rb:86:in `block in initialize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim.rb:85:in `each'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/discourse_image_optim-0.26.2/lib/image_optim.rb:85:in `initialize'
/var/www/discourse/lib/file_helper.rb:109:in `new'
/var/www/discourse/lib/file_helper.rb:109:in `block in image_optim'
/var/www/discourse/lib/file_helper.rb:128:in `memoize'
/var/www/discourse/lib/file_helper.rb:103:in `image_optim'
/var/www/discourse/lib/file_helper.rb:94:in `optimize_image!'
/var/www/discourse/lib/upload_creator.rb:348:in `optimize!'
/var/www/discourse/lib/upload_creator.rb:59:in `block in create_for'
/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'
/var/www/discourse/lib/upload_creator.rb:37:in `create_for'
/var/www/discourse/app/models/user_avatar.rb:118:in `create_custom_avatar'
(eval):55:in `block (3 levels) in run_file'
(eval):54:in `open'
(eval):54:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:58:in `block in open'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:36:in `block in run_file'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:212:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:35:in `run_file'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:26:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:25:in `each'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:25:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/seed-fu-2.3.9/lib/seed-fu.rb:29:in `seed'
/var/www/discourse/lib/tasks/db.rake:130:in `block (4 levels) in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:259:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rails_multisite-2.1.1/lib/rails_multisite/connection_management.rb:61:in `with_connection'
/var/www/discourse/lib/tasks/db.rake:126:in `block (3 levels) in <top (required)>'

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 6, 2020, 10:42am UTC](https://meta.discourse.org/t/multisite-migrate-error/150579/2 "2020-05-06T10:42:37Z")

</div>

Should be easy to resolve just need to add def flush do nothing to the demuxer

@david mind adding it?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 6, 2020, 10:59am UTC](https://meta.discourse.org/t/multisite-migrate-error/150579/3 "2020-05-06T10:59:05Z")

</div>

Sure, here you go

[https://github.com/discourse/discourse/commit/72ad701df0663d6a131531faf506d5424e3ebfb6](https://github.com/discourse/discourse/commit/72ad701df0663d6a131531faf506d5424e3ebfb6)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [May 6, 2020, 11:36am UTC](https://meta.discourse.org/t/multisite-migrate-error/150579/4 "2020-05-06T11:36:02Z")

</div>

18 minutes and you fixed it. That is seriously impressive.

Thanks @david and @sam !!!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 6, 2020, 7:15pm UTC](https://meta.discourse.org/t/multisite-migrate-error/150579/5 "2020-05-06T19:15:36Z")

</div>


