Error rebuilding app, Input/output error


#1

Hi guys,

That’s a long time ago we didn’t came back to open an issue :slight_smile:

We actually encored an error with rebuild, error log is :

`2017-11-04 22:20:44.180 UTC [10796] discourse@discourse ERROR:  could not read block 0 in file "base/16384/2666": Input/output error
2017-11-04 22:20:44.180 UTC [10796] discourse@discourse STATEMENT:  SELECT 1
	FROM INFORMATION_SCHEMA.COLUMNS
	WHERE table_schema = 'public' AND
	  table_name = 'categories' AND
	  column_name IN ('logo_url','background_url') AND
	  EXISTS (
	    SELECT 1
	    FROM schema_migration_details
	    WHERE name = 'AddUploadsToCategories' AND
	          created_at <= (current_timestamp at time zone 'UTC' - interval '60 seconds')
	  )
	LIMIT 1
	
rake aborted!
PG::IoError: ERROR:  could not read block 0 in file "base/16384/2666": Input/output error
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.5/lib/patches/db/pg.rb:50:in `exec'
/var/www/discourse/lib/freedom_patches/active_record_base.rb:7:in `exec_sql'
/var/www/discourse/lib/column_dropper.rb:26:in `drop'
(eval):29:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:46:in `eval'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:58:in `block in open'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:57:in `open'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:36:in `block in run_file'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:35:in `run_file'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:26:in `block in run'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:25:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu/runner.rb:25:in `run'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/seed-fu-2.3.6/lib/seed-fu.rb:29:in `seed'
/var/www/discourse/lib/tasks/db.rake:26:in `block in <top (required)>'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rake-12.1.0/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2017-11-04T22:20:44.287275 #15]  INFO -- : 
== Seed from /var/www/discourse/db/fixtures/001_categories.rb

I, [2017-11-04T22:20:44.288466 #15]  INFO -- : Terminating async processes
I, [2017-11-04T22:20:44.288784 #15]  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/9.5/bin/postmaster -D /etc/postgresql/9.5/main pid: 44
I, [2017-11-04T22:20:44.289526 #15]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 157
157:signal-handler (1509834044) Received SIGTERM scheduling shutdown...
2017-11-04 22:20:44.291 UTC [44] LOG:  received fast shutdown request
2017-11-04 22:20:44.291 UTC [44] LOG:  aborting any active transactions
2017-11-04 22:20:44.292 UTC [51] LOG:  autovacuum launcher shutting down
2017-11-04 22:20:44.301 UTC [48] LOG:  shutting down
157:M 04 Nov 22:20:44.381 # User requested shutdown...
157:M 04 Nov 22:20:44.381 * Saving the final RDB snapshot before exiting.
2017-11-04 22:20:44.409 UTC [48] LOG:  database system is shut down
157:M 04 Nov 22:20:44.518 * DB saved on disk
157:M 04 Nov 22:20:44.518 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 10775 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
8ce642b1f933742f3c8cad4f30a32236867763f25ad7045a8f28c652a91a6407
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one`

An other error like could not read block 0 in file "base/xxxxx/xxxx": Input/output error is throwed trying to access Backups page (it give a 500 error.

Thank you for your help! Rellay don't know what to do and didn't find anything on forum...

(Sam Saffron) #2

Your db is corrupt, ideal solution is restoring from backup.

Read Corruption - PostgreSQL wiki