I keep getting errors when updating

No matter how many times I try to update, I always get Sorry, there was an error updating Discourse. Please check the logs below. when updating via the browser. I always have to rely on Terminal and that isn’t good, because then I will always have to have my forum down for like 30 minutes.

If anyone can help me here, that would be appreciated.

Errors:

Summary
********************************************************
*** Please be patient, next steps might take a while ***
********************************************************
Cycling Unicorn, to free up memory
Restarting unicorn pid: 603
Waiting for Unicorn to reload.
Waiting for Unicorn to reload..
Waiting for Unicorn to reload...
Waiting for Unicorn to reload....
Waiting for Unicorn to reload.....
Waiting for Unicorn to reload......
Waiting for Unicorn to reload.......
Waiting for Unicorn to reload........
Waiting for Unicorn to reload.........
Waiting for Unicorn to reload..........
Waiting for Unicorn to reload...........
Waiting for Unicorn to reload............
Waiting for Unicorn to reload.............
Waiting for Unicorn to reload..............
Waiting for Unicorn to reload...............
Waiting for Unicorn to reload................
Waiting for Unicorn to reload.................
Waiting for Unicorn to reload..................
Waiting for Unicorn to reload...................
Waiting for Unicorn to reload....................
Waiting for Unicorn to reload.....................
Waiting for Unicorn to reload......................
Waiting for Unicorn to reload.......................
Waiting for Unicorn to reload........................
Waiting for Unicorn to reload.........................
Waiting for Unicorn to reload..........................
Waiting for Unicorn to reload...........................
Waiting for Unicorn to reload............................
Waiting for Unicorn to reload.............................
Waiting for Unicorn to reload..............................
Waiting for Unicorn to reload...............................
$ cd /var/www/discourse && git reset --hard HEAD@{upstream}
HEAD is now at fe1b1edba FIX: removes + from RTE toggle tooltip (#33542)
$ bundle install --retry 3 --jobs 4
Bundle complete! 143 Gemfile dependencies, 190 gems now installed.
Gems in the groups 'test' and 'development' were not installed.
Bundled gems are installed into `./vendor/bundle`
3 installed gems you directly depend on are looking for funding.
  Run `bundle fund` for details
$ if [ -f yarn.lock ]; then yarn install; else CI=1 pnpm install; fi
Scope: all 16 workspace projects
Lockfile is up to date, resolution step is skipped
Already up to date

Done in 9.1s using pnpm v9.15.6
$ LOAD_PLUGINS=0 bundle exec rake plugin:pull_compatible_all
discourse-adplugin is already at latest compatible version
discourse-categories-suppressed is already at latest compatible version
discourse-doc-categories is already at latest compatible version
Invalid version list in /var/www/discourse/plugins/discourse-landing-pages
discourse-landing-pages is already at latest compatible version
discourse-solved is already at latest compatible version
docker_manager is already at latest compatible version
$ SKIP_POST_DEPLOYMENT_MIGRATIONS=1 bundle exec rake multisite:migrate
Multisite migrator is running using 1 threads

Migrating default
Seeding default
*** Bundling assets. This will take a while *** 
$ bundle exec rake themes:update assets:precompile
Updating themes with concurrency: 10
[db:default] 'New Topic Header Button' -  checking...
[db:default] 'New Topic Header Button' -  up to date
[db:default] 'Category Banners' -  checking...
[db:default] 'Category Banners' -  up to date
[db:default] 'Clickable Topic' -  checking...
[db:default] 'Clickable Topic' -  up to date
[db:default] 'Tag Banners' -  checking...
[db:default] 'Tag Banners' -  up to date
[db:default] 'Breadcrumb Links' -  checking...
[db:default] 'Breadcrumb Links' -  up to date
[db:default] 'Welcome Link Banner' -  checking...
[db:default] 'Welcome Link Banner' -  up to date
[db:default] 'Tag Icons' -  checking...
[db:default] 'Tag Icons' -  up to date
[db:default] 'Social Share' -  checking...
[db:default] 'Social Share' -  up to date
[db:default] 'Navigation Menu Display Control' -  checking...
[db:default] 'Navigation Menu Display Control' -  up to date
[db:default] 'DiscoTOC' -  checking...
Node.js heap_size_limit is less than 2048MB. Setting --max-old-space-size=2048 and CHEAP_SOURCE_MAPS=1
Existing build is not reusable.
- Existing: {"ember_env"=>"production", "core_tree_hash"=>"c71c1ad482ff7f24c3ad3a76d5a521861f29e1fb"}
- Current: {"ember_env"=>"production", "core_tree_hash"=>"d026d5621e9421eaf67123aab7361a44f0fa9c31"}
Running full core build...
Building
Environment: production
The setting 'staticAddonTrees' will default to true in the next version of Embroider and can't be turned off. To prepare for this you should set 'staticAddonTrees: true' in your Embroider config.
The setting 'staticAddonTestSupportTrees' will default to true in the next version of Embroider and can't be turned off. To prepare for this you should set 'staticAddonTestSupportTrees: true' in your Embroider config.
building...
...[ConfigLoader]
...[Babel: @embroider/macros > applyPatches]
...[Babel: pretty-text > applyPatches]
...[Babel: @ember/legacy-built-in-components > applyPatches]
...[Babel: ember-source > applyPatches]
[BABEL] Note: The code generator has deoptimised the styling of /var/www/discourse/app/assets/javascripts/discourse/ember/ember-template-compiler.js as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of /var/www/discourse/app/assets/javascripts/discourse/ember/ember.js as it exceeds the max of 500KB.
...[Babel: @glimmer/component > applyPatches]
...[Babel: @ember/render-modifiers > applyPatches]
...[Babel: dialog-holder > applyPatches]
...[Babel: ember-this-fallback > applyPatches]
...[Babel: ember-buffered-proxy > applyPatches]
...[Babel: ember-cache-primitive-polyfill > applyPatches]
...[Babel: float-kit > applyPatches]
...[Babel: select-kit > applyPatches]
...[@embroider/compat/app]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
...[@embroider/webpack]
undefined
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command was killed with SIGKILL (Forced termination): ember build -prod
/var/www/discourse/script/assemble_ember_build.rb:103:in `system': Command failed with exit 1: pnpm (RuntimeError)
	from /var/www/discourse/script/assemble_ember_build.rb:103:in `<main>'
Docker Manager: FAILED TO UPGRADE
#<RuntimeError: RuntimeError>
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:211:in `run'
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:112:in `upgrade'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:19:in `block in <main>'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `fork'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `<main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/commands/runner/runner_command.rb:44:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/commands/runner/runner_command.rb:44:in `block in perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/commands/runner/runner_command.rb:70:in `conditional_executor'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/commands/runner/runner_command.rb:43:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/command/base.rb:178:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/command/base.rb:73:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/command.rb:71:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/command.rb:149:in `with_argv'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/command.rb:69:in `invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-7.2.2.1/lib/rails/commands.rb:18:in `<main>'
/usr/local/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
/usr/local/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.18.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bin/rails:18:in `<main>'
Spinning up 1 Unicorn worker(s) that were stopped initially

You need to make a bigger swap file.
I had the same problem. This solved it

1 Like

Can you explain how to? I’m not familiar with that. I remember someone talking about it, but I don’t think I’ve made any changes (well, apparently I probably didn’t and that’s what’s causing this).
Thank you

I recommend upgrading from the command line

cd /var/discourse
./launcher rebuild app

You might still have memory problems. If that fails, include the error and the output of

free -h

EDIT: Oops. Sorry, I didn’t read carefully enough:

Add swap is what to do. The way that I do it is

cd /var/discourse
grep swap discourse-setup

Then you can see the commands that discourse-setup uses to create the swap space.

Then you can do something like

./launcher stop app # if you don't you probably can't turn off swap
swapoff /swapfile # now you found the name of the file was /swapfile
fallocate -l -4GB /swapfile # adjusted from the one in the output
mkswap /swapfile # this "formats" the swap partiion

You can skip the other stuff about adding it to fstab and such, and just turn it back on:

swapon /swapfile
./launcher start app

Then you can check with

free -h

If you have no swap file, then you can run ./discourse-setup and it’ll add it for you and you can control-c when it starts asking you questions.

2 Likes

Use Google or youtube:
“Linux swap file”

1 Like

Here’s Digital Oceans guide:

You usually need to add as much swap as you have RAM.

1 Like

https://meta.discourse.org/search?context=topic&context_id=373634&q=Node.js%20heap_size_limit%20is%20less%20than%202048MB&skip_context=true

1 Like

Updates
After a few conversations with Claude, here’s what’s happening:

I initially had this

sudo swapon --show
NAME      TYPE SIZE USED PRIO
/swapfile file   2G   1G   -2

That was still causing the error.

So I was able to increase it to 4GB, I believe:

sudo swapon --show
NAME      TYPE SIZE   USED PRIO
/swapfile file   4G 714.4M   -2

Now, here’s what’s strange: while I was doing this, I went back to the update page and to my surprise, everything was updated…
How is that possible, if it was showing me that error? :confused:

Anyway, I now at least understand that a swapfile is related to disk space, not RAM. I’m using DigitalOcean’s droplet 1GB RAM, 25GB disk.

So I guess having the 4GB swapfile is ok for now?
But still, why did it update, even after showing me that error?

A swapfile is a way to use some of your disk space as very, very slow RAM, so it’s related to both disk space and RAM.

25GB is just barely enough space. You’ll need to do a ./launcher cleanup before pretty much every command line upgrade.

1 Like

What I meant was that, when I saw discussions about it, when people said “create a 2GB swapfile” I thought it was related to the amount of RAM, so in my case, I would not be able to do it, because I only have 1GB of RAM. Now, I understand that the swapfile, is in fact disk space, almost like creating a small partition. So, yes, they are related, because they “communicate” with each other when necessary, but I was being more literal with my comment.

That’s all I can afford at the moment and since I still have no real community, that’s enough. I will upgrade as the community grows.

So, you’re saying that before each update, even when using the admin panel to update, I should run ./launcher cleanup via Terminal?

No. Using the admin panel doesn’t make docker make more images it’s not using, but you may not have enough memory (ram plus swap) to do the upgrade from the admin panel.

This is all a bit confusing to me…
Some people said they were having the same issue as me, and creating the 2GB swapfile helped them. I now created the 4GB swapfile, but that was after I updated, so I will have to wait for another update to test it.

So, for example, if I upgrade to 2GB of RAM would that be good enough, even if the disk space is still 25GB?

I’m very new to all this, so I apologize if this is too obvious for most people. I’m just trying to figure things out as I work on it.

1GB machine with 4GB swap should be enough.

I would personally recommend at least 2GB with 2GB swap to start with but you meet the published minimum requirements of a standard install.

I would move on and use it and only upgrade if you find things are too slow.

You should have no problems with memory now.

1 Like

Except, as you said, HDD will be full quite fast, and cleanup is must to do no matter how much there is RAM.