That worked – thank you Rob!


From: Robert Levas [mailto:[email protected]]
Sent: Tuesday, April 11, 2017 11:19 AM
To: [email protected]
Subject: Re: CacheLoader returned null for key

Hi Tom…

I think I just ran into this as well. It wasn’t clear what caused it. Whether 
it is an Ambari upgrade bug or whether some view was not properly removed 
before the upgrade – maybe related to a stack upgrade?

In any case, check out the Ambari DB and see if there are any orphaned 
adminresource records.

SELECT adminresource.resource_id
 FROM adminresource LEFT OUTER JOIN viewinstance USING (resource_id)
 WHERE adminresource.resource_type_id > 5
 AND viewinstance.view_instance_id IS NULL;

If you get any records back, they are the orphaned adminresource records 
causing the issue.  Once removed, you should be back in business.

You should backup your database before making any changes.  Then remove the 
relevant records from the adminprivilege and adminresource tables:

delete from adminprivilege where resource_id in (<resource ids from the query 
above>);

delete from adminresource where resource_id in (<resource ids from the query 
above>);

Once the records are removed, restart Ambari and the issue should be fixed.

Rob


From: Stewart Thomas J 
<[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Date: Tuesday, April 11, 2017 at 10:46 AM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: CacheLoader returned null for key

I upgraded to Ambari 2.5.0.3 and I am getting this exception when an LDAP user 
tries to login. The local admin user can login fine. My users/groups shows 
blank in user/group management as well, however the users/groups tables in the 
Ambari database have data in them.

11 Apr 2017 09:17:39,517 ERROR [ambari-client-thread-53] ReadHandler:102 - 
Caught a runtime exception executing a query
com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader 
returned null for key 153.
        at 
com.google.common.cache.LocalCache$Segment.getAndRecordStats(LocalCache.java:2348)
        at 
com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318)
        at 
com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
        at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
        at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
        at 
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827)
        at 
org.apache.ambari.server.controller.internal.UserPrivilegeResourceProvider.toResource(UserPrivilegeResourceProvider.java:347)
        at 
org.apache.ambari.server.controller.internal.UserPrivilegeResourceProvider.getResources(UserPrivilegeResourceProvider.java:301)
        at 
org.apache.ambari.server.controller.internal.ClusterControllerImpl$ExtendedResourceProviderWrapper.queryForResources(ClusterControllerImpl.java:966)
        at 
org.apache.ambari.server.controller.internal.ClusterControllerImpl.getResources(ClusterControllerImpl.java:141)

I am assuming there is something mucked up in the tables, but need assistance 
on which ones to investigate for this condition. That line in the code is doing:
  final ViewInstanceEntity viewInstanceEntity = 
viewInstanceCache.get().getUnchecked(privilegeEntity.getResource().getId())

Thanks,

Tom


Reply via email to