Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1492047 - Old interfaces are never removed from Foreman DB
Summary: Old interfaces are never removed from Foreman DB
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.4.0
Assignee: Shimon Shtein
QA Contact: Lai
URL:
Whiteboard:
: 1455891 1473644 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-15 10:44 UTC by Ivan Necas
Modified: 2021-06-10 13:02 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:18:33 UTC
Target Upstream Version:


Attachments (Terms of Use)
One interface removed (39.71 KB, image/png)
2018-09-21 20:01 UTC, Lai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 19244 0 High Closed Old interfaces are never removed from Foreman DB 2020-07-04 11:35:51 UTC
Red Hat Knowledge Base (Solution) 3143031 0 None None None 2018-02-27 12:28:20 UTC

Description Ivan Necas 2017-09-15 10:44:56 UTC
Hosts like hypervisors or docker hosts may often change interfaces (e.g. network bridges) which confuses Foreman and during fact import it creates more and more interfaces, old are never deleted. After some time when a host passes thousands of interfaces, due to O(n^2) one fact upload can take several minutes of processing.

We need to delete old interfaces from Foreman database, either during fact upload directly or on schedule (those that hasn't been updated for a while).

The behvior is really bad, Foreman eats up all memory until passenger process is restarted, which can take a while (non-Enterprise version do not have maximum memory setting).

Comment 1 Ivan Necas 2017-09-15 10:45:03 UTC
Created from redmine issue http://projects.theforeman.org/issues/19244

Comment 2 Ivan Necas 2017-09-15 10:45:08 UTC
Upstream bug assigned to None

Comment 4 Ivan Necas 2017-09-15 10:48:06 UTC
*** Bug 1473644 has been marked as a duplicate of this bug. ***

Comment 7 Francisco Garcia 2018-01-05 09:25:10 UTC
*** Bug 1455891 has been marked as a duplicate of this bug. ***

Comment 8 Satellite Program 2018-01-24 19:14:33 UTC
Upstream bug assigned to sshtein@redhat.com

Comment 9 Satellite Program 2018-01-24 19:14:37 UTC
Upstream bug assigned to sshtein@redhat.com

Comment 10 Satellite Program 2018-02-14 11:15:57 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/19244 has been resolved.

Comment 12 Ivan Necas 2018-09-21 15:00:59 UTC
Verification steps:

1. register a host with multiple network interfaces
2. ensure the interfaces are loaded when going to the host details, and that the interfaces are not marked as managed
3. Go to Administer -> Settings -> Provisioning, add a pattern that would match one of the interfaces "Ignore interfaces with matching identifier"
4. foreman-rake interfaces:clean
5. the interfaces that match the pattern should be removed from the host

Comment 13 Lai 2018-09-21 20:01:30 UTC
Created attachment 1485789 [details]
One interface removed

Followed inecas' instruction.

1. Registered a host with multiple network interfaces
2. Saw that interfaces are not marked as managed. (eth1)
3. Added eth1 to the "Ignore interfaces with matching identifier" list
4. Ran foreman-rake interface:clean
5. Checked that the eth1 interface was removed.

-bash-4.2# foreman-rake interfaces::clean
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
rake aborted!
Don't know how to build task 'interfaces::clean' (see --tasks)
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
-bash-4.2# foreman-rake interfaces:clean
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:182: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
Starting ingnored interfaces clean up...
Finished, cleaned 1 interfaces

Check attachment for eth1 not showing up.

Comment 15 Bryan Kearney 2018-10-16 19:18:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927


Note You need to log in before you can comment on or make changes to this bug.