Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 973039 - Inconsistent exception handling in IDM DAO layer
Inconsistent exception handling in IDM DAO layer
Product: JBoss Enterprise Portal Platform 6
Classification: JBoss
Component: Portal (Show other bugs)
Unspecified Unspecified
high Severity high
: ER02
: 6.1.0
Assigned To: Default User
Depends On:
  Show dependency treegraph
Reported: 2013-06-11 02:57 EDT by Martin Weiler
Modified: 2013-10-06 20:34 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: In releases prior to JPP 6.1 some exceptions thrown from IDM were not correctly handled in JPP. Especially we sometimes did not perform rollback of Hibernate transaction in case of Hibernate error, which could lead to inconsistent state and incorrect behaviour. Fix: Currently all fixes thrown by IDM layer are correctly handled and logged and we are always perform rollback of DB transaction in both non-JTA and JTA configuration
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker GTNPORTAL-2928 Major Resolved Attempt to save very long property of UserProfile breaks whole database 2016-01-19 04:43 EST
JBoss Issue Tracker GTNPORTAL-3110 Major Resolved IDM DAO classes are only catching IdentityExceptions 2016-01-19 04:43 EST

  None (edit)
Description Martin Weiler 2013-06-11 02:57:39 EDT
Description of problem:
Exception handling in the IDM DAO layer is inconsistent/incomplete:
* GTNPORTAL-2928: Exceptions are swallowed completely
* GTNPORTAL-3110: Exception handling is inconsistent

How reproducible:

Steps to Reproduce:
1. IDM operation fails with an error (eg. Hibernate exception, database exception) in, for example, UserDAOImpl.authenticate(..) method when the lastLoginTime attribute is saved for the user
2. An exception is thrown:

ERROR [org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl]  ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated
: org.hibernate.exception.ConstraintViolationException: ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated
        at org.exoplatform.services.organization.auth.OrganizationAuthenticatorImpl.validateUser(OrganizationAuthenticatorImpl.java:152) [exo.core.component.organization.api-2.5.1-CP01-redhat-1.jar:2.5.1-CP01-redhat-1]
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (PORTAL_IDM_OWNER.JBID_IO_ATTR_TEXT_VALUES_PK) violated

3. Every IDM operation that happens afterwards on the same thread is failing:

INFO  [org.exoplatform.services.organization.idm.UserDAOImpl]  Cannot obtain user: user1; : org.picketlink.idm.common.exception.IdentityException: Cannot obtain Hibernate Session
Caused by: org.hibernate.TransactionException: nested transactions not supported
        at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:152) [hibernate-core-4.1.6.Final-redhat-3.jar:4.1.6.Final-redhat-3]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreSessionImpl.startHibernateTransaction(HibernateIdentityStoreSessionImpl.java:207) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreSessionImpl.startHibernateTransactionIfNotStartedYet(HibernateIdentityStoreSessionImpl.java:195) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]
        at org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl.getHibernateSession(HibernateIdentityStoreImpl.java:2786) [picketlink-idm-hibernate-1.4.1.Final-redhat-1.jar:1.4.1.Final-redhat-1]

Actual results:
Exception is not handled correctly, causing the transaction status captured in HibernateIdentityStoreSessionImpl.hibernateTxStatus ThreadLocal to be wrong, which affects all subsequent operations on the same thread.

Expected results:
Exception is handled correctly, not affecting further IDM operations on the same thread.

Additional info:
Comment 1 Tomas Kyjovsky 2013-08-13 11:53:56 EDT
Verified in 6.1.0.ER02.

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