Cannot build on arm, Zlib::BufError during assets:precompile

On Hetzner CAX21 VPS with aarch64 CPU, when I run ./launcher rebuild web.yml, it aborted with the following error: Please help.

I, [2024-05-24T14:07:05.408434 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /usr/local/lib/ruby/3.3.0/observer.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add observer to your Gemfile or gemspec. Also contact author of rmagick-4.2.2 to add observer into its gemspec.
Purging temp files
Bundling assets
I, [2024-05-24T14:07:12.220787 #2680]  INFO -- : Writing /var/www/discourse/public/assets/break_string-cc617154cd957804f2f6a1f3bc68258c9cdca3d4b9a322bf777d145fed04790e.js
I, [2024-05-24T14:07:12.229550 #2680]  INFO -- : Writing /var/www/discourse/public/assets/service-worker-f149bdcc45f1996961aa7d1e44bbaaa67fbfc013f6976595afe544acfe5664dc.js
I, [2024-05-24T14:07:12.248203 #2680]  INFO -- : Writing /var/www/discourse/public/assets/locales/i18n-3b40e842fd72b9bcc74ea83e094c823cd9ca535e4ecc5e78722e6f99d3656137.js
I, [2024-05-24T14:07:12.253509 #2680]  INFO -- : Writing /var/www/discourse/public/assets/scripts/discourse-test-listen-boot-9b14a0fc65c689577e6a428dcfd680205516fe211700a71c7adb5cbcf4df2cc5.js
I, [2024-05-24T14:07:13.226151 #2680]  INFO -- : Writing /var/www/discourse/public/assets/locales/ar-6e08f3f970e658a14b18a835d3c1fb286846ea94e333ac46242e166eff29dd22.js
I, [2024-05-24T14:07:13.682780 #2680]  INFO -- : Writing /var/www/discourse/public/assets/locales/be-762dabfdc99a559d5cf6fb691049fb50a71fa828e3dd48818a94dc62dc988f71.js
I, [2024-05-24T14:07:14.148990 #2680]  INFO -- : Writing /var/www/discourse/public/assets/locales/bg-28b8fd14f6bcc195da7401a451a222ccc958e1b285df4bb7e95d65f356bad2ec.js
I, [2024-05-24T14:07:14.431154 #2680]  INFO -- : Writing /var/www/discourse/public/assets/locales/bs_BA-34f2fe1480f5a9c77ddf0dfb26ad4751e793ce56b1cc48e9ad6e9867c5e08094.js
rake aborted!
Zlib::BufError: buffer error (Zlib::BufError)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache/file_store.rb:100:in `<<'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache/file_store.rb:100:in `set'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache.rb:212:in `set'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache.rb:136:in `set'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:243:in `store_asset'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:185:in `load_from_unloaded'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:60:in `block in load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:44:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/bundle.rb:23:in `block in call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/utils.rb:201:in `dfs'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/bundle.rb:24:in `call'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/processor_utils.rb:75:in `call_processor'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/processor_utils.rb:56:in `call_processors'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:60:in `block in load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/loader.rb:44:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cached_environment.rb:47:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/base.rb:66:in `find_asset'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/manifest.rb:134:in `block in find'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/manifest.rb:133:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/manifest.rb:133:in `find'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/manifest.rb:186:in `compile'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:67:in `block (3 levels) in define'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/rake/sprocketstask.rb:147:in `with_logger'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:66:in `block (2 levels) in define'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
I, [2024-05-24T14:07:14.967828 #1]  INFO -- : Downloading MaxMindDB...



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 2678 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"precompile", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'"]}
bootstrap failed with exit code 1
** 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.
26e64935c29000e8c019ed676034a16e2d988ec28a2cd9164e142ee83c086ded
root@ubuntu-8gb-nbg1-1:/var/discourse#  

After commenting out some plugins, I can rebuild again. Let me pinpoint which plugin causes this.

Finally, it turns out to be the plugin https://github.com/discourse/discourse-animated-avatars and its accompanying script which causes the issue, commenting out the plugin clone line and

- exec:
    cd: $home/plugins/discourse-animated-avatars
    raise_on_fail: false
    cmd:
      - $home/plugins/discourse-animated-avatars/scripts/install.sh

… will work.

3 Likes

I have the same problem and when I turn off the exec part of discourse-animated-avatars the rebuild works.

Cross-linking a recent similar report Rebuild fails when these plugins are present - #5 by JammyDodger, though no Animated Avatars for that one. Initial thoughts were Subscriptions.

It turns out that removing the comments for the install.sh part and rebuild a second time after it was working the first time without the install.sh part, it also builds with it. Strange…

I don’t think it was subscriptions. I removed subscriptions and it still worked. Then I commented out the maxmind key and ID and it worked. So it looks to me like something is still broken with Maxmind. It just doesn’t make any sense that a problem with Maxmind causes the whole build to fail. I’ll try to do a bit more work to see what it issue is, but just making it so that an error with Maxmind isn’t a show stopper.

My idle guess at this point is that you can have spurious errors like a network issue, their servers overloaded, rate limiting, or whatever and that sends back garbage which then doesn’t unzip (since it’s not a zip file).

This Maxmind code just got reworked for the ID/Key pair. I’m disappointed that this “maxmind causes a build to fail” error was preserved. (Or so it seems).

2 Likes