Repository navigation
Fail to create the ElasticSearch indices #18625
Description
Activity
I can reproduce this. I got rid of the security error messages by adding the lines below to
/etc/elasticsearch/elasticsearch.yml. Note that the security role that I picked has wide powers, because I just wanted to get this running at all - a more restrictive role might be more appropriate.discovery.type: single-node xpack.security.enabled: true xpack.security.authc: anonymous: username: anonymous_user roles: superuser authz_exception: trueThis did not fix the progressbar error though.
I'm on a production server running Mastodon v3.5.3. OS is Debian 11.
Reacted by Dashamir Hoxha and Ahmet AkkoçAfter running the server for a few days, I can no longer reproduce this problem. So, it must be related to an initial state somehow.
I'm not a ruby dev, but what I found was, that
/home/mastodon/live/lib/mastodon/search_cli.rb:67:indeploy' seems to point to the right direction.If I change
progress.total = indices.sum { |index| importers[index].estimate! }to just assigning an arbitrary number like
progress.total = 2000then the command runs 'just fine' and indices get created.
Seems like the calculation of indices fails and hence is nil (or whatever the ruby equivalent is), which causes progressbar so throw an error.This somehow makes sense, as the initial progress (which would be zero, I guess) would be higher than the calculated total of nil/undefined/whatever.
Maybe that's of any help.
Replicated here as well
Mastodon 4.0.0rc1
Ruby 3.0.4p208
PostgreSQL 14.5
Redis 6.2.7$ RAILS_ENV=production bin/tootctl search deploy/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/progress.rb:76:in `total=': You can't set the item's total value to less than the current progress. (ProgressBar::InvalidProgressError) from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:178:in `block in update_progress' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/output.rb:43:in `with_refresh' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:177:in `update_progress' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:101:in `total=' from /opt/mastodon/lib/mastodon/search_cli.rb:67:in `deploy' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start' from bin/tootctl:8:in `<main>'ES:
{ "name" : "example", "cluster_name" : "example", "cluster_uuid" : "z3LNO3tdTN2oDlKcVSYgOw", "version" : { "number" : "7.17.7", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "78dcaaa8cee33438b91eca7f5c7f56a70fec9e80", "build_date" : "2022-10-17T15:29:54.167373105Z", "build_snapshot" : false, "lucene_version" : "8.11.1", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }Using authentication on ES; user has access to ONLY indices under its own namespace (defaults to REDIS_NAMESPACE).
pcap indicates it's creating the indices no problem, no 404s being returned during this process:
POST /masteh28_chewy_specifications/_search HTTP/1.1 Authorization: Basic aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kUXc0dzlXZ1hjUQ x-elastic-client-meta: es=7.13.3,rb=3.0.4,t=7.13.3,fd=1.9.3,hc=2.8.3 User-Agent: elasticsearch-ruby/7.13.3 (RUBY_VERSION: 3.0.4; linux x86_64; Faraday v1.9.3) Content-Type: application/json Accept: */* Accept-Encoding: gzip,deflate Date: Sat, 05 Nov 2022 17:05:00 GMT Content-Length: 70 Host: 172.17.0.1:9200 {"size":1,"query":{"bool":{"filter":{"ids":{"values":["accounts"]}}}}} HTTP/1.1 200 OK X-elastic-product: Elasticsearch content-type: application/json; charset=UTF-8 content-encoding: gzip content-length: 743 <data>Can confirm that hacky fix by @oliverjkb works here; within my mastodon web docker image, just ran:
sed -E 's/indices.sum.+/2000/g' -i lib/mastodon/search_cli.rbReacted by Josh SantangeloTried
sed -E 's/indices.sum.+/2000/g' -i lib/mastodon/search_cli.rbBut I still have an error but I get a part of a progress bar:
/opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/progress.rb:76:in `total=': You can't set the item's total value to less than the current progress. (ProgressBar::InvalidProgressError)--=---=---=---=---=-| ETA: ??:??:?? (0 docs/s) from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:178:in `block in update_progress' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/output.rb:43:in `with_refresh' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:177:in `update_progress' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/base.rb:101:in `total=' from /opt/mastodon/lib/mastodon/search_cli.rb:67:in `deploy' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch' from /opt/mastodon/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start' from bin/tootctl:8:in `<main>'Are you exporting an already extant, massive database? In which case I suspect s/2000/2000000/g - hacky as it might be - might do the trick?
brand new install with 1 user, 2 posts , so no, not a massive db ;)
Odd; can you confirm the versions you're on? (preferences > admin > "software" box)
Software
Mastodon 3.5.3
Ruby 3.0.3p157
PostgreSQL 14.5
Redis 7.0.5(create with docker-compose, from a git pull this morning)
Seems to work today... Don't know why !
Facing the same error and @oliverjkb 's fix didn't work. Maybe it will work after a few days. Is there a fix coming?
Ran into this today, the sed command above worked to resolve it. I'm also a brand new Mastodon site with 2 users (both me) and 0 posts.
Yesterday it didn't work. Today it did...
to be honest I'd be tempted to just remove this feature rather than try fix; progress bar offers no inherent value vs potentially causing buggy deploys.
For what it's worth, I'm also getting a ProgressBar::InvalidProgressError on a new server without any posts yet. I'll just wait for a while and try again.
- added a commit that references this issue
on Oct 3, 2023 I've submitted a fix for this issue, please test if anyone's still getting this: #27258
Reacted by GiantFrog

Steps to reproduce the problem
Expected behaviour
A message or indicator that indexes have been created
Actual behaviour
You can't set the item's total value to less than the current progress. (ProgressBar::InvalidProgressError)
Specifications
Mastodon 3.53
Ubuntu Server 20.04.4
openjdk version "17.0.3" 2022-04-19
elasticsearch 7.17.4
Postgres 14.3-1