无法在arm上构建,assets:precompile过程中出现Zlib::BufError

在 Hetzner CAX21 VPS 上,使用 aarch64 CPU 时,运行 ./launcher rebuild web.yml 会因以下错误而中止:请帮忙。

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.
正在清除临时文件
正在打包资源
I, [2024-05-24T14:07:12.220787 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/break_string-cc617154cd957804f2f6a1f3bc68258c9cdca3d4b9a322bf777d145fed04790e.js
I, [2024-05-24T14:07:12.229550 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/service-worker-f149bdcc45f1996961aa7d1e44bbaaa67fbfc013f6976595afe544acfe5664dc.js
I, [2024-05-24T14:07:12.248203 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/locales/i18n-3b40e842fd72b9bcc74ea83e094c823cd9ca535e4ecc5e78722e6f99d3656137.js
I, [2024-05-24T14:07:12.253509 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/scripts/discourse-test-listen-boot-9b14a0fc65c689577e6a428dcfd680205516fe211700a71c7adb5cbcf4df2cc5.js
I, [2024-05-24T14:07:13.226151 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/locales/ar-6e08f3f970e658a14b18a835d3c1fb286846ea94e333ac46242e166eff29dd22.js
I, [2024-05-24T14:07:13.682780 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/locales/be-762dabfdc99a559d5cf6fb691049fb50a71fa828e3dd48818a94dc62dc988f71.js
I, [2024-05-24T14:07:14.148990 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/locales/bg-28b8fd14f6bcc195da7401a451a222ccc958e1b285df4bb7e95d65f356bad2ec.js
I, [2024-05-24T14:07:14.431154 #2680]  INFO -- : 正在写入 /var/www/discourse/public/assets/locales/bs_BA-34f2fe1480f5a9c77ddf0dfb26ad4751e793ce56b1cc48e9ad6e9867c5e08094.js
rake 已中止!
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
(运行带有 --trace 的任务可查看完整跟踪)
I, [2024-05-24T14:07:14.967828 #1]  INFO -- : 正在下载 MaxMindDB...


失败
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile' 失败,返回值为 #<Process::Status: pid 2678 exit 1>
失败位置:/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec 失败,参数为 {"cd"=>"$home", "tag"=>"precompile", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'"]}
引导失败,退出代码为 1
** 引导失败 ** 请向上滚动查找更早的错误消息,可能不止一个。
./discourse-doctor 可能有助于诊断问题。
26e64935c29000e8c019ed676034a16e2d988ec28a2cd9164e142ee83c086ded
root@ubuntu-8gb-nbg1-1:/var/discourse#  

注释掉一些插件后,我可以再次重建。我将找出是哪个插件导致了这个问题。

最后,发现是插件 https://github.com/discourse/discourse-animated-avatars 及其附带的脚本导致了问题,注释掉插件克隆行和

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

… 就可以工作了。

3 个赞

我遇到了同样的问题,当我关闭 discourse-animated-avatars 的 exec 部分时,重建就可以正常工作。

链接一篇近期相似的报告 https://meta.discourse.org/t/rebuild-fails-when-these-plugins-are-present/310455/5,尽管那篇没有关于 Animated Avatars 的内容。最初的想法是 Subscriptions。

事实证明,在第一次不带 install.sh 部分就能正常工作后,移除 install.sh 部分的注释并第二次重新构建,它也能正常构建。奇怪……

我认为不是订阅的问题。我删除了订阅,它仍然有效。然后我注释掉了 maxmind 的 key 和 ID,它就生效了。所以在我看来,Maxmind 仍然有问题。Maxmind 的问题导致整个构建失败,这完全说不通。我会再做一些工作来找出问题所在,但至少要确保 Maxmind 的错误不会导致构建中断。

我目前的猜测是,可能会出现一些偶然的错误,比如网络问题、服务器过载、速率限制等等,这些错误会返回垃圾数据,然后这些数据无法解压(因为它不是 zip 文件)。

这段 Maxmind 代码刚刚重构了 ID/Key 对。我很失望,“maxmind 导致构建失败”的错误似乎被保留了下来(至少看起来是这样)。

3 个赞