RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1777806 - When Service weight is set as 0 for server in IPA location "IPA Error 903: InternalError" is displayed
Summary: When Service weight is set as 0 for server in IPA location "IPA Error 903: In...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: ipa
Version: 8.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: François Cami
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-28 11:08 UTC by Sudhir Menon
Modified: 2020-11-04 02:50 UTC (History)
7 users (show)

Fixed In Version: ipa-4.8.7-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 02:50:15 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Sudhir Menon 2019-11-28 11:08:25 UTC
Description of problem: When Service weight is set as 0 for server in IPA location "IPA Error 903: InternalError" is displayed

Version-Release number of selected component (if applicable):
ipa-server-4.8.2-2.module+el8.2.0+4736+360582ce.x86_64


How reproducible: Always


Steps to Reproduce:
1. Install IPA server with 2 locations
2. Setup replica.rhel82.test in one location1 with Service weight 10
3. Setup replica2.rhel82.test in another location2 with Service weight 0

Actual results:
2. Server replica.rhel82.test is added to the location1 with Service weight 10
3. Although not sure if weight of 0 is correct, but when replica2.rhel82.test is added to location2 with Service weight 0 an error is displayed on the UI 'Error 903: Internal error is occured'


httpd error_log
  1 [Thu Nov 28 16:02:26.740769 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950] ipa: ERROR: non-public: ZeroDivisionError: float division by zero
  2 [Thu Nov 28 16:02:26.740801 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950] Traceback (most recent call last):
  3 [Thu Nov 28 16:02:26.740805 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]   File "/usr/lib/python3.6/site-packages/ipaserver/rpcserver.py", line 368, in wsgi_execute 
  4 [Thu Nov 28 16:02:26.740809 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]     result = command(*args, **options)
  5 [Thu Nov 28 16:02:26.740812 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 450, in __call__
  6 [Thu Nov 28 16:02:26.740815 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]     return self.__do_call(*args, **options)
  7 [Thu Nov 28 16:02:26.740818 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 478, in __do_call 
  8 [Thu Nov 28 16:02:26.740821 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]     ret = self.run(*args, **options)
  9 [Thu Nov 28 16:02:26.740824 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 800, in run
 10 [Thu Nov 28 16:02:26.740827 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]     return self.execute(*args, **options)
 11 [Thu Nov 28 16:02:26.740831 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]   File "/usr/lib/python3.6/site-packages/ipaserver/plugins/location.py", line 230, in execute
 12 [Thu Nov 28 16:02:26.740834 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]     int(server['ipaserviceweight'][0])*100.0/weight_sum)
 13 [Thu Nov 28 16:02:26.740838 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950] ZeroDivisionError: float division by zero
 14 [Thu Nov 28 16:02:26.740853 2019] [wsgi:error] [pid 8648:tid 140034638186240] [remote :49950]
~                                                                                                      

Expected results: 
Fix the error "IPA Error 903: InternalError" 

Additional info:

Comment 1 François Cami 2019-12-02 08:40:36 UTC
Taking for investigation.

Quoting https://tools.ietf.org/html/rfc2782

Weight
        A server selection mechanism.  The weight field specifies a
        relative weight for entries with the same priority. Larger
        weights SHOULD be given a proportionately higher probability of
        being selected. The range of this number is 0-65535.  This is a
        16 bit unsigned integer in network byte order.  Domain
        administrators SHOULD use Weight 0 when there isn't any server
        selection to do, to make the RR easier to read for humans (less
        noisy).  In the presence of records containing weights greater
        than 0, records with weight 0 should have a very small chance of
        being selected.

Comment 2 François Cami 2019-12-02 11:58:48 UTC
The RFC states that weight=0 is a valid use-case.

If all servers in a location have weight=0, the sum of their weights is still 0:

            for server in servers:
                weight = int(server.get('ipaserviceweight', [100])[0])
                weight_sum += weight

leading to a division by zero later on:

            for server in servers_additional_info.values():
                server['service_relative_weight'] = [
                    u'{:.1f}%'.format(
                        int(server['ipaserviceweight'][0])*100.0/weight_sum)
                ]

Comment 3 François Cami 2019-12-02 12:40:30 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/8135

Comment 10 errata-xmlrpc 2020-11-04 02:50:15 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 (Moderate: idm:DL1 and idm:client security, bug fix, and enhancement update), 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-2020:4670


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