Satellite 6: ActiveRecord::StatementInvalid (PG::Error: ERROR: integer out of range)
Environment
- Satellite 6.x
Issue
- Can't login to WebUI and getting "We're sorry, but something went wrong."
- Can't register new servers
- 'hammer ping' doesn't produce any output
Resolution
- Clean current sessions:
# foreman-rake db:sessions:clear
- Restart the sequence:
# sudo su - postgres -c "psql -d foreman -c ' alter sequence sessions_id_seq restart with 1;'"
Root Cause
The sessions_id_seq sequence in foreman database grew bigger than integer and Satellite can't add a new session record with ID bigger than integer.
Diagnostic Steps
Look for log messages like these:
=== production.log ===
2018-10-19 11:46:36 39364d1c [app] [F]
| ActiveRecord::StatementInvalid (PG::Error: ERROR: integer out of range
| : INSERT INTO "sessions" ("created_at", "data", "session_id", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"):
| lib/middleware/tagged_logging.rb:18:in `call'
=== postgresql log ===
2018-10-20 14:40:18 AEDT STATEMENT: INSERT INTO "sessions" ("session_id", "data", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"
2018-10-20 14:40:18 AEDT ERROR: integer out of range
2018-10-20 14:40:18 AEDT STATEMENT: INSERT INTO "sessions" ("session_id", "data", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"
SBR
Product(s)
Components
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.