Bug 858282 - Globally uncaught exception when creating duplicate role
Globally uncaught exception when creating duplicate role
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Core Server, Core UI, Usability (Show other bugs)
4.5
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: RHQ 4.6
Assigned To: Jirka Kremser
Mike Foley
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-18 10:39 EDT by Filip Brychta
Modified: 2013-08-31 06:16 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-31 06:16:18 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
CLI script with reproduction steps (298 bytes, application/javascript)
2013-02-01 07:42 EST, Filip Brychta
no flags Details

  None (edit)
Description Filip Brychta 2012-09-18 10:39:38 EDT
Description of problem:
$Summary

Version-Release number of selected component (if applicable):
Version: 4.5.0-SNAPSHOT
Build Number: 6c45114

How reproducible:
Always

Steps to Reproduce:
1. create some new role (Administration->Roles->new)
2. create the same role again

  
Actual results:
Globally uncaught exception:
ERROR: duplicate key value violates unique constraint "rhq_role_name_key" Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
Detail :	

java.lang.RuntimeException:java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   java.lang.RuntimeException:[1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
--- STACK TRACE FOLLOWS ---
java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
Caused by: java.lang.RuntimeException: [1347978546494] java.lang.RuntimeException:javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.transaction.RollbackException:[com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state -> javax.persistence.EntityExistsException:org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update -> org.hibernate.exception.ConstraintViolationException:Could not execute JDBC batch update -> java.sql.BatchUpdateException:Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause.[SQLException=Batch entry 0 insert into RHQ_ROLE (NAME, DESCRIPTION, FSYSTEM, ID) values ('newRole', NULL, '0', '10052') was aborted.  Call getNextException to see the cause. -> ERROR: duplicate key value violates unique constraint "rhq_role_name_key"
  Detail: Key (name)=(newRole) already exists.(error-code=0,sql-state=23505)]
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)
   at Unknown.anonymous(Unknown Source)


Expected results:
Some more user friendly notification
Comment 1 Jirka Kremser 2012-09-26 06:26:08 EDT
The same applies to the creating duplicate user.
Comment 2 Jirka Kremser 2012-09-27 08:12:53 EDT
http://git.fedorahosted.org/cgit/rhq/rhq.git/diff/?id=dad120d

fixed in master
time:    Thu Sep 27 14:06:14 2012 +0200
commit:  dad120db6d26c739b47b841cc0b43028a255073c
author:  Jirka Kremser - jkremser@redhat.com
message: [BZ 858282 - Globally uncaught exception when creating duplicate role] If rhq_role_name_key db constraint is violated, more informative message is returned to the client. Instead of "Globally uncaught exception..." with db implementation details. The same thing for user creation.
Comment 3 Armine Hovsepyan 2012-11-21 07:29:18 EST
verified in rhq master (4.6)

Globally uncaught exception is removed and replaced with correct exception text, and the exception is shown in server log.
Comment 4 Filip Brychta 2013-02-01 07:41:48 EST
Still not working on 
Version: 4.6.0-SNAPSHOT
Build Number: a74896a

Globally uncaught exception is still there.

Adding CLI script which does the repro steps.
Please check the exception thrown by CLI client as well. There is no explaining message at all.
Comment 5 Filip Brychta 2013-02-01 07:42:14 EST
Created attachment 691573 [details]
CLI script with reproduction steps
Comment 6 Jirka Kremser 2013-02-01 08:05:31 EST
fixed in master
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=af0936f97

time:    Fri Feb 1 14:02:40 2013 +0100
commit:  af0936f97b11698157731942134e181db6e11af6
author:  Jirka Kremser - jkremser@redhat.com
message: [BZ 858282 - Globally uncaught exception when creating duplicate role] RoleManager now explicitly checks whether the role with the same name already exists (without trying to create the role first and then catching the exception like it was done before).


As a consequence of this commit, the CLI now prints nicely the real cause of the problem as well.
Comment 7 Filip Brychta 2013-02-07 10:25:02 EST
Verified on 
Version: 4.6.0-SNAPSHOT
Build Number: 73a33d5

Verified for both GUI and CLI
Comment 8 Heiko W. Rupp 2013-08-31 06:16:18 EDT
Bulk close of old bugs in VERIFIED state.

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