当 MAXMIND 每日配额用尽时,重建总是失败

请问可以在下次发布前修复这个问题吗?我正在测试部署新的 VPS(每次 IP 都不同),但仍然有三分之二次部署失败。

2 个赞

请注意,我们刚刚发布了一个快速修复程序,该程序可以在下载 Maxmind 数据库失败时防止重建失败。

Discourse 3.3 发布后,我们将重新审视如何使下载 Maxmind 数据库的错误更少。

4 个赞

嗯,对我来说它仍然失败(全新安装,不是重建)?

I, [2024-07-30T05:19:47.753779 #1]  INFO -- : cd /var/www/discourse & su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'
Purging temp files
Bundling assets
I, [2024-07-30T05:19:58.764890 #1059]  INFO -- : Writing /var/www/discourse/public/assets/break_string-cc617154cd957804f2f6a1f3bc68258c9cdca3d4b9a322bf777d145fed04790e.js
I, [2024-07-30T05:19:58.787966 #1059]  INFO -- : Writing /var/www/discourse/public/assets/service-worker-77c5660ded6e2c94a6a5ce2594411b46d0e15a1f5b9065e57b85652d7cbe3ead.js
I, [2024-07-30T05:19:58.797458 #1059]  INFO -- : Writing /var/www/discourse/public/assets/locales/i18n-3b40e842fd72b9bcc74ea83e094c823cd9ca535e4ecc5e78722e6f99d3656137.js
I, [2024-07-30T05:19:58.807019 #1059]  INFO -- : Writing /var/www/discourse/public/assets/scripts/discourse-test-listen-boot-9b14a0fc65c689577e6a428dcfd680205516fe211700a71c7adb5cbcf4df2cc5.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/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.5.1/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.5.1/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-07-30T05:20:01.382260 #1]  INFO -- : Downloading MaxMindDB...

I, [2024-07-30T05:20:01.438870 #1]  INFO -- : Terminating async processes
I, [2024-07-30T05:20:01.444360 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-
cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 57
2024-07-30 05:20:01.448 UTC [57] LOG:  received fast shutdown request
I, [2024-07-30T05:20:01.449248 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf p
id: 120
120:signal-handler (1722316801) Received SIGTERM scheduling shutdown...
2024-07-30 05:20:01.512 UTC [57] LOG:  aborting any active transactions
120:M 30 Jul 2024 05:20:01.523 # User requested shutdown...
120:M 30 Jul 2024 05:20:01.526 * Saving the final RDB snapshot before exiting.
2024-07-30 05:20:01.566 UTC [57] LOG:  background worker "logical replication launcher" (PID 72) exited with exit code 1
120:M 30 Jul 2024 05:20:01.586 * DB saved on disk
120:M 30 Jul 2024 05:20:01.589 # Redis is now ready to exit, bye bye...
2024-07-30 05:20:01.598 UTC [67] LOG:  shutting down
2024-07-30 05:20:02.090 UTC [57] LOG:  database system is shut down


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse & su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile' fa
iled with return #<Process::Status: pid 1057 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.
c9da27502f7c288ec5465ca82b4830123a3c59003527b8f288457c594576adaa
x86_64 arch detected.

只是为了确认,您是否遵循了 discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub 并拥有有效的 maxmind 凭证?

是的,标准安装,在 app.yml 中有有效的 maxmind account_id 和 license_key

只是为了确认,您是在 tests-passed 分支上,而不是在 stable 分支上?我刚刚用一个无效的 maxmind 密钥进行了测试,没有看到任何错误。

我不确定问题是否还与错误的凭据有关,但即使使用正确的凭据,重新构建也可能失败。

2 个赞

是的

没错,我使用的是一个有效的密钥!(刚刚第二次尝试,新的 VPS,不同的 IP,仍然以相同的错误失败)。

1 个赞

我在从管理员更新 Docker 时遇到了错误。我想知道问题是否是由创建的文件引起的。此错误始终以相同的方式发生,并且当我们关闭 maxmind 时不会出现错误。这两个结构之间存在问题,并且它们之间存在相互影响:

我开始认为 Maxmind 在这里是声东击西。堆栈跟踪根本没有指向 Maxmind,而是指示 sprockets 中抛出了一个错误。我必须进一步挖掘,看看是否能在 droplet 上重现这个问题。

3 个赞

我也这么认为。Maxmind 可能不是问题,但它的活动使一些领域的问题浮出水面。

1 个赞

您是在DigitalOcean上运行的吗?如果是,我能知道您选择的vCPU和RAM数量吗?

不,我有自己的服务器,PostgreSQL 位于单独的服务器上。我在这里做了一个笔记,您可以查看:

您的服务器有多少内存和 CPU?我正在尝试重现此问题,并且在我的液滴上已经重建了许多次,但无法重现该错误。

主服务器 25gb ram
postgresql 服务器 20gb ram

8 个 CPU
CPU 核心 4

db_shared_buffers: "4096MB"
UNICORN_WORKERS: 8
UNICORN_SIDEKIQ_MAX_RSS: 1500
## 插件在此处添加
## 详情请参阅 https://meta.discourse.org/t/19157
hooks:
  after_code:
     - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-question-answer.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-gamification.git
          - git clone https://github.com/discourse/discourse-restricted-replies.git
          - git clone https://github.com/discourse/discourse-saved-searches.git
          - git clone https://github.com/discourse/discourse-follow.git
#         - git clone https://github.com/discourse/discourse-yearly-review.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-no-bump.git
          - git clone https://github.com/discourse/discourse-math.git
          - git clone https://github.com/discourse/discourse-akismet.git
          - git clone https://github.com/discourse/discourse-adplugin.git
          - git clone https://github.com/spirobel/discourse-matheditor.git
          - git clone https://github.com/discourse/discourse-google-one-tap.git
          - git clone https://github.com/discourse/discourse-ai.git
#         - git clone https://github.com/paviliondev/discourse-custom-wizard.git
          - git clone https://github.com/discourse/discourse-reactions.git
          - git clone https://github.com/discourse/discourse-subscriptions.git
          - git clone https://github.com/discourse/discourse-assign.git
#         - git clone https://github.com/discourse/discourse-policy.git
          - git clone https://github.com/discourse/discourse-data-explorer.git
#         - git clone https://github.com/merefield/discourse-chatbot.git

#  after_assets_precompile:
#     - exec:
#        cd: $home
#        cmd:
#          - sudo -E -u discourse bundle exec rake s3:upload_assets
#          - sudo -E -u discourse bundle exec rake s3:expire_missing_assets
#          - sudo -E -u discourse bundle exec rake uploads:migrate_to_s3

我今天在一台(我认为)拥有 16GB 内存(但还有其他东西在运行)和 12 个或更多线程(我明天可以提供确切数字)的机器上遇到了这个问题。看起来 maxmind 确实是个干扰项,但每次禁用 maxmind 都能解决问题(我今天就是这么做的)。

但现在你和我尝试在 maxmind 函数中添加 rescue,但它并没有解决问题。

也许是预编译时发生了一些事情?

2 个赞

我对这个有疑问:assets:precompile

通过遵循这一系列事件并检查它们之间发生的事件,我们可能会获得一些见解:

打包资源

下载 MaxMindDB..
(也许错误就在其中某个环节)
assets:precompile

我刚意识到,我们在运行 assets:precompile 的同时在后台线程中下载 Maxmind 数据库。根据我看到的堆栈跟踪,我有一个假设,即我们用于下载 Maxmind 数据库的后台线程以某种方式干扰了 assets:precompile

我将先发布上述修复程序,并且不深入研究根本原因,因为我们将把 Maxmind 数据库的下载移出构建过程。

5 个赞

这听起来是个好主意。我明天会在几个网站上尝试重新启用 MaxMind。

我现在可以测试一下吗?因为当管理员更新时出现了一个错误,我想通过 SSH 进行操作,但也在那里遇到了错误。如果你告诉我怎么做,我可以先尝试一下。

1 个赞