Bug 675703

Summary: Case sensitivity of hfs groups
Product: Red Hat Enterprise MRG Reporter: Lubos Trilety <ltrilety>
Component: condorAssignee: Erik Erlandson <eerlands>
Status: CLOSED ERRATA QA Contact: Lubos Trilety <ltrilety>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.3CC: iboverma, jneedle, matt, mhusnain
Target Milestone: 2.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: condor-7.6.0-0.2 Doc Type: Bug Fix
Doc Text:
Cause: Case folding of submitter names in Accountant (introduced for Hierarchical Acct Groups) was not perfectly consistent, which resulted in multiple submitter entries in the Accountant differing only in case (if submitter name had any upper-case letters in it). Consequence: Any submission using an submitter name with upper-case characters would manifest two entries in condor_userprio: a case-folded entry (all lower) and a non-case-folded entry. Fix: Explicit case folding of submitter names was removed from the Accountant (and corresponding points in negotiator). Data maps were updated with case-insensitive sorting functor. Result: 1) Submitters with upper-case letters no longer cause duplicate case-folded entries in Accountant. 2) Accounting Group entries are now "case-preserving": the case stored in accountant is the first one encountered -- subsequent case-equivalent submitter names match against that entry in a case-insensitive way. 3) Full submitter entries ([group.]user@host) are case sensitive (which is consistent with upstream policy). Release Notes Entry: Due to case folding of submitted names in Accountant, multiple submitter name entries would be created in condor_userprio (one entirely in lower case and one with the correct mix of upper and lower case characters) if the submitter name entry contained upper case letters. Explicit case folding is now removed from the Accountant and data maps are updated with a case-insensitive sorting functor. As a result, submitter names with upper case letters no longer appear as multiple entries and Accounting group entries now match updated entries by case and full submitted entries are case sensitive.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:38:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 693778    
Attachments:
Description Flags
NegotiatorLog none

Description Lubos Trilety 2011-02-07 13:05:33 UTC
Created attachment 477406 [details]
NegotiatorLog

Description of problem:
HFS accounting groups are case sensitive. They are supposed to be case insensitive, but they are only working in lower-case. 
It could cause group limit exceeding.

Version-Release number of selected component (if applicable):
condor-7.4.5-0.8

How reproducible:
100%

Preparation:
configuration file:
NEGOTIATOR_DEBUG = D_FULLDEBUG | D_MATCH
SCHEDD_INTERVAL = 15
NUM_CPUS = 20
GROUP_NAMES = A, B
GROUP_QUOTA_DYNAMIC_A = 0.25
GROUP_QUOTA_DYNAMIC_B = 0.2
GROUP_AUTOREGROUP_A = FALSE
GROUP_AUTOREGROUP_B = FALSE

submit file:
$ cat test.submit 
universe = vanilla
cmd = /bin/sleep
args = 5m
+AccountingGroup = "A.user"
queue 10
+AccountingGroup = "B.user"
queue 10


Steps to Reproduce:
1. wait until all slots are up and ready
$ condor_status
Name               OpSys      Arch   State     Activity LoadAv Mem   ActvtyTime
slot10@<hostname>  LINUX      X86_64 Unclaimed Idle     0.000   398  0+00:00:05
...
                     Machines Owner Claimed Unclaimed Matched Preempting
        X86_64/LINUX       20     0       0        20       0          0

2. submit jobs from test.submit
$ condor_submit test.submit
Submitting job(s)....................
20 job(s) submitted to cluster 1.

3. wait till jobs start, see 'condor_q -run -l | grep AccountingGroup | sort | uniq -c' and 'condor_userprio -l'
$ condor_q -run -l | grep AccountingGroup | sort | uniq -c
     10 AccountingGroup = "A.user"
     10 AccountingGroup = "B.user"
$ condor_userprio -l
LastUpdate = 1297081632
Name1 = "A.user@hostname"
Priority1 = 0.500000
ResourcesUsed1 = 0
...
Name2 = "a.user@hostname"
Priority2 = 0.500000
ResourcesUsed2 = 10
...
Name3 = "B.user@hostname"
Priority3 = 0.500000
ResourcesUsed3 = 0
...
Name4 = "b.user@hostname"
Priority4 = 0.500000
ResourcesUsed4 = 10
...
Name5 = "a"
Priority5 = 0.500000
ResourcesUsed5 = 10
...
Name6 = "b"
Priority6 = 0.500000
ResourcesUsed6 = 10
...
NumSubmittors = 6
  

Actual results:
all 20 jobs are running
group a ... 10
group b ... 10

Only A.user and B.user are used in submit file, but there are following lines in condor_userprio -l:
Name1 = "A.user@hostname"
Name2 = "a.user@hostname"
Name3 = "B.user@hostname"
Name4 = "b.user@hostname"


Expected results:
only 9 jobs should run
group a ... 5
group b ... 4

Additional info:
see negotiator log in attachment
this bug is very similar to the old one: bug 632476

Comment 1 Erik Erlandson 2011-02-07 17:56:00 UTC
I don't think this is a regression -- the variable "AccountingGroup" in the job classad is set by condor_submit and is not case-folded.  The Accountant (and negotiator) does maintain all accounting group names case-folded.

Comment 2 Matthew Farrellee 2011-02-07 20:19:47 UTC
Understanding - 1) Accountant does the right thing, case folds, 2) condor_userprio may report confusing information, does not case fold

Comment 3 Lubos Trilety 2011-02-08 09:01:22 UTC
I don't know where the problem lies exactly but it is because of case sensitivity for sure.
When I try the same scenario with 'a' and 'b' as names of groups, instead of 'A', 'B', I get correct result:
$ condor_q -run -l | grep AccountingGroup | sort | uniq -c
      5 AccountingGroup = "a.user"
      4 AccountingGroup = "b.user"

I am aware that if I submit as both 'a.user' and 'A.user' then condor_userprio report both of them as different user. But in my scenario I used only 'A.user', so I expect to see only this one, moreover I was able to run more jobs than the limit is.

Another example of bad behaviour:
NUM_CPUS = 10
GROUP_NAMES = A
GROUP_QUOTA_DYNAMIC_A = 0.5

# condor_userprio -setfactor A.user@`hostname` 4
The priority factor of A.user@<hostname> was set to 4.000000

# echo -e "cmd=/bin/sleep\nargs=1d\n+AccountingGroup=\"A.user\"\nqueue 10" | runuser condor -s /bin/bash -c "condor_submit"
Submitting job(s)..........
10 job(s) submitted to cluster 1.

# condor_q
-- Submitter: hostname : <IP:57924> : hostname
 ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD               
   1.0   condor          2/8  03:40   0+00:00:00 I  0   0.0  sleep 1d          
...
10 jobs; 10 idle, 0 running, 0 held

# condor_q -run -l | grep AccountingGroup | sort | uniq -c
     10 AccountingGroup = "A.user"

# condor_userprio -l
LastUpdate = 1297154488
Name1 = "a.user@hostname"
Priority1 = 0.501600
ResourcesUsed1 = 10
...
PriorityFactor1 = 1.000000
Name2 = "A.user@hostname"
Priority2 = 2.000000
ResourcesUsed2 = 0
...
PriorityFactor2 = 4.000000
Name3 = "a"
Priority3 = 0.501600
ResourcesUsed3 = 10
...
PriorityFactor3 = 1.000000
NumSubmittors = 3

See that the submitter, under which jobs run, has no correct priority factor.

And again if I use 'a' everything is OK.
# condor_userprio -l
LastUpdate = 1297155425
Name1 = "a"
Priority1 = 0.500722
ResourcesUsed1 = 5
...
PriorityFactor1 = 1.000000
Name2 = "a.user@hostname"
Priority2 = 2.002888
ResourcesUsed2 = 5
...
PriorityFactor2 = 4.000000
NumSubmittors = 2

Comment 4 Erik Erlandson 2011-03-15 16:43:33 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
Case folding of submitter names in Accountant (introduced for Hierarchical Acct Groups) was not perfectly consistent, which resulted in multiple submitter entries in the Accountant differing only in case (if submitter name had any upper-case letters in it).

Consequence:
Any submission using an submitter name with upper-case characters would manifest two entries in condor_userprio: a case-folded entry (all lower) and a non-case-folded entry.

Fix:
Explicit case folding of submitter names was removed from the Accountant (and corresponding points in negotiator).  Data maps were updated with case-insensitive sorting functor.

Result:
1) Submitters with upper-case letters no longer cause duplicate case-folded entries in Accountant.  
2) Accounting Group entries are now "case-preserving": the case stored in accountant is the first one encountered -- subsequent case-equivalent submitter names match against that entry in a case-insensitive way.  
3) Full submitter entries ([group.]user@host) are case sensitive (which is consistent with upstream policy).

Comment 5 Lubos Trilety 2011-04-26 10:15:04 UTC
(In reply to comment #4)

> 3) Full submitter entries ([group.]user@host) are case sensitive (which is
> consistent with upstream policy).

Does it mean that the 'A.user' is different user as 'a.user'?
So for example if I want to set priority factor for user 'user' in group 'a'('A') I have to run two following commands:
condor_userprio -setfactor A.user@`hostname` 4
condor_userprio -setfactor a.user@`hostname` 4

Comment 6 Erik Erlandson 2011-04-26 15:10:29 UTC
(In reply to comment #5)
> Does it mean that the 'A.user' is different user as 'a.user'?
> So for example if I want to set priority factor for user 'user' in group
> 'a'('A') I have to run two following commands:
> condor_userprio -setfactor A.user@`hostname` 4
> condor_userprio -setfactor a.user@`hostname` 4


Yes, that is correct.   Full submitter names are case sensitive, as in this example output below.   You can see that there are multiple full-submitter names that differ only by case.   However, there are only four group names: they are stored (and display) as the first case that was encountered (which is from the config file), and subsequent groups match against them, in a case insensitive way.


[eje@rorschach acct_case_test]$ condor_userprio -all
Last Priority Update:  4/26 08:04
                                    Effective   Real     Priority   Res   Total Usage       Usage            Last      
User Name                           Priority  Priority    Factor    Used (wghted-hrs)    Start Time       Usage Time   
------------------------------      --------- -------- ------------ ----  ----------- ---------------- ----------------
B.b.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
b.B.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
B.A.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
B.A.USER@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
b.a.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
A.A.USER@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
a.a.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
A.b.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
a.B.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
A.A.user@localdomain                     0.50     0.50         1.00    1         0.01  4/26/2011 08:04  4/26/2011 08:04
B.B                                      0.50     0.50         1.00    2         0.02  4/26/2011 08:04  4/26/2011 08:04
a.B                                      0.50     0.50         1.00    2         0.02  4/26/2011 08:04  4/26/2011 08:04
b.a                                      0.50     0.50         1.00    3         0.03  4/26/2011 08:04  4/26/2011 08:04
A.a                                      0.50     0.50         1.00    3         0.03  4/26/2011 08:04  4/26/2011 08:04
------------------------------      --------- -------- ------------ ----  ----------- ---------------- ----------------
Number of users: 10                                                   10         0.08  4/26/2011 08:04  4/25/2011 08:05

Comment 7 Lubos Trilety 2011-04-26 15:40:57 UTC
Tested with:
condor-7.6.1-0.1

Tested on:
RHEL5 i386,x86_64  - passed
RHEL6 i386,x86_64  - passed


>>> VERIFIED

Comment 8 Misha H. Ali 2011-06-01 03:03:21 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -10,4 +10,8 @@
 Result:
 1) Submitters with upper-case letters no longer cause duplicate case-folded entries in Accountant.  
 2) Accounting Group entries are now "case-preserving": the case stored in accountant is the first one encountered -- subsequent case-equivalent submitter names match against that entry in a case-insensitive way.  
-3) Full submitter entries ([group.]user@host) are case sensitive (which is consistent with upstream policy).+3) Full submitter entries ([group.]user@host) are case sensitive (which is consistent with upstream policy).
+
+Release Notes Entry:
+
+Due to case folding of submitted names in Accountant, multiple submitter name entries would be created in condor_userprio (one entirely in lower case and one with the correct mix of upper and lower case characters) if the submitter name entry contained upper case letters. Explicit case folding is now removed from the Accountant and data maps are updated with a case-insensitive sorting functor. As a result, submitter names with upper case letters no longer appear as multiple entries and Accounting group entries now match updated entries by case and full submitted entries are case sensitive.

Comment 9 Misha H. Ali 2011-06-06 03:30:37 UTC
Technical note can be viewed in the release notes for 2.0 at the documentation stage here:

http://documentation-stage.bne.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/2.0/html-single/MRG_Release_Notes/index.html#tabl-MRG_Release_Notes-GRID_Update_Notes-RHM_Known_Issues

Comment 10 errata-xmlrpc 2011-06-23 15:38:07 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html