Project

General

Profile

Bug #7353

Installation occasionally fails: failed to call refresh: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0] with "Validation failed: Name has already been taken" in katello-installer.log

Added by Ivan Necas almost 5 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1135989
Version-Release number of selected component (if applicable):
katello-installer-0.0.64-1.el7sat.noarch

How reproducible:
rare

Steps to Reproduce:

yum install -y katello
katello-installer

Actual results:

[...]
[31m /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0]
[0m[31m /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0]
[0mNotice: /Stage[main]/Foreman::Database/Foreman::Ra: 488/489, 99%, 0.0/s, elapsed: 00:07:03
[...]
E, [2014-08-31T22:46:53.324338 #29233] ERROR -- : : 488/489, 99%, 0.0/s, elapsed: 00:12:33
[31m /Stage[main]/Foreman_proxy::Register/Foreman_smartproxy[ibm-ls22-03.rhts.eng.brq.redhat.com]: Could not evaluate: 500 Internal Server Error
[0m[32mDone [0m: 489/489, 100%, 0.0/s, elapsed: 00:12:37
[32mDone [0m: 489/489, 100%, 0.0/s, elapsed: 00:12:37
[1m[31mSomething went wrong![0m Check the log for ERROR-level output
The full log is at [1m[36m/var/log/katello-installer/katello-installer.log[0m
:: [ FAIL ] :: Command 'katello-installer --foreman-admin-email 'root@localhost' --foreman-admin-username 'admin' --foreman-admin-password 'changeme'' (Expected 0, got 6)

Expected results:
Installer succeeds

Additional info:

The issue seems to be caused by race-condition in initializing the settings data (happen in an initializer). The httpd was sterted just before the db:seed (so that the rails environments started to be loaded at the same time, and probably started also filling the settings table: when initializing, the code first checks whether the settings are there, and if not, it creates them.

It seems the case here is two parallel processes (on from passenger, the second form db:seed) look if some settings exist (bot get an information, that the settings are not there yet), so both try to create the settings, but the second one fails on conflict, because in the meantime, the first process have already managed to save that.

Workaround:

echo >> /etc/foreman/database.yml
katello-installer

Associated revisions

Revision dcde6712 (diff)
Added by Ivan Necas over 4 years ago

Fixes #4611,#7353 - control the db_pending_migration/db_pending_seed from installer

This allows tracking the state of migration/seeding in the database
and making sure the rake tasks are done on subsequential installer attempts when
something goes wrong the first time.

Also, as part of the `foreman-config` calls, we ensure that the
settings are initialised before the httpd starts (preventing the
race-conditions happening when the httpd and rake db:seed start at the
same time)

Closes GH-225

History

#1 Updated by Ivan Necas almost 5 years ago

  • Status changed from New to Assigned

#2 Updated by Dominic Cleal over 4 years ago

  • Project changed from Foreman to Installer
  • Legacy Backlogs Release (now unused) set to 29

#3 Updated by Ivan Necas over 4 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF