A Hibernate Issue

Dmitri Dolguikh dmitri at redhat.com
Fri Feb 26 18:54:32 UTC 2010


On 02/26/2010 02:47 PM, Devan Goodwin wrote:
> Hey guys, BK found an issue with hibernate, essentially he was
> starting Candlepin in tomcat, loading a cert, which creates
> entitlement pools each affiliated with an owner. When he then went to
> his new API call for owner/{id}/entitlementpool to get the list, it
> would come back empty, even though the pools were in the db and
> correctly pointing to the owner. Restart tomcat, hit the same URL, and
> now the entitlement pools would appear.
>
> The issue was this:
>
> diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
> b/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
> index 3d618e8..c24e93f 100644
> --- a/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
> +++ b/proxy/src/main/java/org/fedoraproject/candlepin/model/SpacewalkCertificateCurator.java
> @@ -134,6 +134,7 @@ public class SpacewalkCertificateCurator {
>           ep.setStartDate(start);
>           ep.setEndDate(end);
>           ep.setCurrentMembers(0);
> +        owner.addEntitlementPool(ep);
>           entitlementPoolCurator.create(ep);
>       }
>
> I know we've seen this issue before both in CP and back in Spacewalk,
> and pretty sure we've had some conversations about it at times too, I
> thought the outcome of that was to do the above.
>
> The call to create the entitlement pool does end up calling flush, so
> I don't think this is the issue, but Hibernate still keeps the owner
> object laying around.
>
> When a new call comes in to our REST API, should this be using a
> cached Owner? I kinda thought it would clear the cache on each
> request. (if not is that something we could/should do?)
>
> Any other insight or solutions to this problem?
>
> Thanks,
>
> Devan
>
>    

hmm. i don't think cache is the culprit, since we have different 
transactions/entity managers on each request.

i can look around once i'm a bit out of the woods with the cert auth 
stuff? unless this is very high-priority.

-d





More information about the candlepin mailing list