Project

General

Profile

Bug #26009

Clear session count to be able to login again

Added by Ondřej Pražák over 1 year ago. Updated 4 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Description of problem:
Can't open a new foreman session. WebUI gives "We're sorry, but something went wrong.". API calls return Error 500.

=== 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' ===

Steps to Reproduce:
1. It is unclear how this actually happens in production, reproducer is to modify your last value in foreman.sessions_id_seq to something bigger than integer. So the next value for ID in foreman.sessions will be bigger than integer. Like:

foreman=# alter sequence sessions_id_seq restart with 2151782968;
ALTER SEQUENCE
foreman=# select * from sessions_id_seq;
sequence_name | last_value | start_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
-----------------+------------+-------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
sessions_id_seq | 2151782969 | 1 | 1 | 9223372036854775807 | 1 | 1 | 31 | f | t
(1 row)
foreman=# \d+ sessions;
Table "public.sessions"
Column | Type | Modifiers | Storage | Stats target | Description
------------+-----------------------------+-------------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('sessions_id_seq'::regclass) | plain | |
session_id | character varying(255) | not null | extended | |
data | text | | extended | |
created_at | timestamp without time zone | | plain | |
updated_at | timestamp without time zone | | plain | |
Indexes:
"sessions_pkey" PRIMARY KEY, btree (id)
"index_sessions_on_session_id" btree (session_id)
"index_sessions_on_updated_at" btree (updated_at)

Actual results:
"We're sorry, but something went wrong." in the webui. Not able to register new servers, etc.

Expected results:
Functionality as usual.

Additional info:

Fix is to restart the sequence with 1 to bring your Foreman back online.

foreman=# alter sequence sessions_id_seq restart with 1;
ALTER SEQUENCE


Related issues

Related to Foreman - Bug #29027: Session id out of range errorClosed

History

#1 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_maintain/pull/256 added

#2 Updated by Ondřej Ezr 8 months ago

  • Related to Bug #29027: Session id out of range error added

#3 Updated by Kavita Gaikwad 4 months ago

  • Assignee set to Suraj Patil
  • Status changed from Ready For Testing to Resolved
  • Subject changed from Clear session count to be able to login again to Clear session count to be able to login again

The issue mentioned in this ticket is fixed in https://projects.theforeman.org/issues/29027 so marking a ticket as resolved.

Also available in: Atom PDF