cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving list of users within role failed

Former Member
0 Kudos

Hi,

I have a problem retrieving a list of users who are member of a specific role.

Please note: We are connected to LDAP which contains 150K users

I have the following code:


List userList = new ArrayList();
Iterator userMembersIterator;
  	
try {
	IUserFactory userFactory           = UMFactory.getUserFactory();
		
	IRoleFactory roleFactory           = UMFactory.getRoleFactory();
	IRoleSearchFilter roleSearchFilter = roleFactory.getRoleSearchFilter();

	roleSearchFilter.setUniqueName(roleID, ISearchAttribute.LIKE_OPERATOR, true); 
	roleSearchFilter.setMaxSearchResultSize(100);
		
	ISearchResult results              = roleFactory.searchRoles(roleSearchFilter);
		
	if (results.hasNext()) {
		userMembersIterator = roleFactory.getRole((String)results.next()).getUserMembers(true);
		while (userMembersIterator.hasNext() && cnt < 100) {
			userList.add(userFactory.getUser((String)userMembersIterator.next()).getDisplayName());
			cnt++;	
		}	
	}
}
catch (UMException e) {
	//log.error("An error occured while getting the list of roles. Exception: " + e, e);
}	

However, when retrieving a large amount of users (<i>i.e. getting the results for a role which has 90K users attached</i>), I receive NullPointerExceptions, Out of Memory errors, PortalRuntimeErrors, and I have to restart SAP WAS subsequently.

When retrieving a small list of users (<i>i.e. getting the results for a role which has only a small number of users attached</i>), everything works as expected.

We use a server with 4 CPU, 16GB memory.

Is there a way to limit the results for the getUserMembers() method, or retrieving the users in a batch of say 100 each?

Any help on this matter would be greatly appreciated!

With kind regards,

Robin van het Hof

Message was edited by: Robin van het Hof

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Robin,

I guess for unlimited search result you will have to specify limit of '0' or smaller.

roleSearchFilter.setMaxSearchResultSize(-1);

You can see API for more details at:

https://media.sdn.sap.com/javadocs/NW04/SP9/ume/com/sap/security/api/IPrincipalSearchFilter.html

ps: now I know why I see so many mails for dev Portal restart

Regards,

Piyush

Answers (2)

Answers (2)

Former Member
0 Kudos

Robin,

I just realized that there is Out of Memory exception and causing JVM Crash

That means either ,

1) VM cannot allocate memory for new objects due to unavailability of space in heap

2)classloader tries to load new class but cannot do due to permspace of the memory is full

In your case it looks 1 is causing the problem.

If JVM Setting is already set to

-verbose:gc

-XX:+PrintGCDetails

-XX:+PrintGCTimeStamps

-XX:+PrintCompliation

Run the VM with -server -client

then check std_server0.out logs and see the method which causes the crash (if there)

Regards,

Piyush

Former Member
0 Kudos

Hi Piyush,

Thanks for your replies

I will check the JVM server out logs ASAP, thanks for pointing this out

I'll keep you posted!

Regards, Robin

former_member271246
Participant
0 Kudos

Try setting a max on the filter like the following.

roleSearchFilter.setMaxSearchResultSize(1000000);