Bug 835875 - Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,573
Summary: Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.Abs...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Management
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: Dmitri Dolguikh
QA Contact: Garik Khachikyan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-06-27 11:53 UTC by James Laska
Modified: 2015-01-04 21:59 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Deletion of a previously promoted repository from the Providers screen resulted in a JDBC runtime error if recreated with the same name, due to the association with environments. This fix denies deletion of promoted repositories from the Providers screen unless deleted from existing environments.
Clone Of:
Environment:
Last Closed: 2014-03-18 17:38:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
katello-debug-20120627075212.tar.gz (3.43 MB, application/octet-stream)
2012-06-27 11:53 UTC, James Laska
no flags Details
katello-debug-20130208130639.tar.gz (8.14 MB, application/octet-stream)
2013-02-08 18:09 UTC, James Laska
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:1543 0 normal SHIPPED_LIVE Important: CloudForms System Engine 1.1 update 2012-12-05 00:39:57 UTC

Description James Laska 2012-06-27 11:53:44 UTC
Created attachment 594748 [details]
katello-debug-20120627075212.tar.gz

Description of problem:

After removing a repository from a custom provider, I then created a new repository with the same name.  The following error resulted ...

{"displayMessage":"Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,573"}

Version-Release number of selected component (if applicable):
 * candlepin-0.6.5-1.el6_2.src.rpm
 * katello-0.1.318-1.el6cf.src.rpm
 * katello-candlepin-cert-key-pair-1.0-1.src.rpm
 * katello-certs-tools-1.0.7-1.el6_3.src.rpm
 * katello-cli-0.1.112-1.el6cf.src.rpm
 * katello-configure-0.1.110-1.el6_3.src.rpm
 * katello-qpid-broker-key-pair-1.0-1.src.rpm
 * katello-qpid-client-key-pair-1.0-1.src.rpm
 * katello-selinux-0.1.10-1.el6.src.rpm
 * pulp-1.0.4-1.el6.src.rpm


How reproducible:


Steps to Reproduce:
1. Create a custom provider, product and repository
2. Sync repository and attach to system templates ... promote (unsure if this step is required)
3. Delete the repository created in step#1
4. Create a new repository attached to the same product, using the same name used in step#1
  
Actual results:

{"displayMessage":"Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,573"}

Expected results:

 * It should succeed, or I should get a warning that I cannot use the same name?

Additional info:

 * See katello-debug attached

Comment 1 Lukas Zapletal 2012-08-28 10:24:50 UTC
REPRODUCED

I can confirm that it's the promotion that triggers the bug. Synchronization, attaching to a template did not reproduce it.

[root@aa ~]# kk provider create --name prov
Successfully created provider [ prov ]

[root@aa ~]# kk product create --name product --provider prov
Created ...

[root@aa ~]# kk repo create --name repo --product product --url http://lzap.fedorapeople.org/fakerepos/zoo5/
Successfully created repository [ repo ]

[root@aa ~]# kk repo delete --name repo --product product
Deleted repository '95'

[root@aa ~]# kk repo create --name repo --product product --url http://lzap.fedorapeople.org/fakerepos/zoo5/
Successfully created repository [ repo ]

[root@aa ~]# kk product synchronize --name product
Product [ product ] synchronized                                      

[root@aa ~]# kk repo delete --name repo --product product
Deleted repository '97'

[root@aa ~]# kk repo create --name repo --product product --url http://lzap.fedorapeople.org/fakerepos/zoo5/
Successfully created repository [ repo ]

[root@aa ~]# kk product synchronize --name product
Product [ product ] synchronized                                      

[root@aa ~]# kk environment create --name env --prior Library
Successfully created environment [ env ]

[root@aa ~]# kk changeset create --name ch1 --environment env
Successfully created changeset [ ch1 ] for environment [ env ]

[root@aa ~]# kk changeset update --name ch1 --environment env --add_product product
Successfully updated changeset [ ch1 ]

[root@aa ~]# kk changeset promote --name ch1 --environment env
Changeset [ ch1 ] applied                 

[root@aa ~]# kk repo delete --name repo --product product
Deleted repository '98'

[root@aa ~]# kk repo create --name repo --product product --url http://lzap.fedorapeople.org/fakerepos/zoo5/
Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598

Comment 2 Lukas Zapletal 2012-08-30 14:32:52 UTC
https://github.com/Katello/katello/pull/550

Comment 3 Lukas Zapletal 2012-09-03 10:03:46 UTC
Ignore the comment 2 ^^^

The exception is:

Sep 03 11:59:35 [http-8443-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "cp_content_label_key"
Sep 03 11:59:35 [http-8443-1] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into cp_content (created, updated, contentUrl, gpgUrl, label, metadataExpire, name, releaseVer, requiredTags, type, vendor, id) values ('2012-09-03 11:59:34.624000 +02:00:00', '2012-09-03 11:59:34.624000 +02:00:00', '/custom/product/repo', '', 'ACME_Corporation_product_repo', NULL, 'repo', NULL, NULL, 'yum', 'Custom', '1346666374624') was aborted.  Call getNextException to see the cause.

Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into cp_content (created, updated, contentUrl, gpgUrl, label, metadataExpire, name, releaseVer, requiredTags, type, vendor, id) values ('2012-09-03 11:59:34.624000 +02:00:00', '2012-09-03 11:59:34.624000 +02:00:00', '/custom/product/repo', '', 'ACME_Corporation_product_repo', NULL, 'repo', NULL, NULL, 'yum', 'Custom', '1346666374624') was aborted.  Call getNextException to see the cause.

Comment 4 Lukas Zapletal 2012-09-06 12:40:41 UTC
After discussion on the list (Re: [katello-devel] Demotions and deletions - solution) this solution is to be implemented:

1. If the user attempts to delete a repo (from providers screen) and
the repo was not previously promoted, allow the deletion to occur.
(This is also today's behavior.)

2. If the user attempts to delete a repo (from providers screen) and
the repo was previously promoted:

      a. Do not allow the repo to be deleted.  In order to support this,

          i. Disable the 'remove' link so the user doesn't have theoption.
             Add a tipsy next to the remove link that when hovered theuser
             can be given information on 'why' the remove link isdisabled.
             (e.g. "Before removing this repo from the product, itmust first
             be deleted from the following environments using a deletion
             changeset: A, B, C.")

More info in the thread.

Comment 5 Lukas Zapletal 2012-09-10 12:43:58 UTC
witlessb is taking over

Comment 6 Dmitri Dolguikh 2012-09-11 14:48:21 UTC
fixed in a2fa896bb1078f792df3d329e684e6bb83ce5b16.

Comment 8 Garik Khachikyan 2012-09-18 11:37:42 UTC
# REOPEN

I have to reopen the bug: as UI allows removal of the provider which has the repo promoted. I think the whole sequence of: provider->product->repo needs to be locked if there is a single promotion (of product/repo) there.

Same exception occur:
---
Resources::Candlepin::Content: 500 Internal Server Error {"displayMessage":"Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,569"} (POST /candlepin/content/) (RestClient::InternalServerError)
{"displayMessage":"Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,569"}
Click here for more details.
---

checked on CFSE version:
---

python-qpid-0.7.946106-1.el6.noarch
candlepin-cert-consumer-brno-cfse.usersys.redhat.com-1.0-1.noarch
qpid-cpp-client-0.14-16.el6.x86_64
candlepin-0.7.8-1.el6cf.noarch
katello-glue-pulp-1.1.12-7.el6cf.noarch
qpid-cpp-server-ssl-0.14-16.el6.x86_64
katello-candlepin-cert-key-pair-1.0-1.noarch
mod_wsgi-3.3-3.pulp.el6.x86_64
python-isodate-0.4.4-4.pulp.el6.noarch
katello-cli-common-1.1.8-1.git.2.a0908e7.el6.noarch
katello-cli-1.1.8-1.git.2.a0908e7.el6.noarch
qpid-cpp-client-ssl-0.14-16.el6.x86_64
python-oauth2-1.5.170-2.pulp.el6.noarch
pulp-common-1.1.12-1.el6cf.noarch
pulp-selinux-server-1.1.12-1.el6cf.noarch
m2crypto-0.21.1.pulp-7.el6.x86_64
candlepin-selinux-0.7.8-1.el6cf.noarch
katello-common-1.1.12-7.el6cf.noarch
katello-glue-candlepin-1.1.12-7.el6cf.noarch
katello-1.1.12-7.el6cf.noarch
katello-all-1.1.12-7.el6cf.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-certs-tools-1.1.8-1.el6cf.noarch
katello-repos-1.1.2-1.el6.noarch
katello-agent-1.1.2-1.el6.noarch
katello-configure-1.1.9-3.el6cf.noarch
qpid-cpp-server-0.14-16.el6.x86_64
pulp-1.1.12-1.el6cf.noarch
katello-selinux-1.1.1-1.el6cf.noarch
candlepin-tomcat6-0.7.8-1.el6cf.noarch
katello-qpid-client-key-pair-1.0-1.noarch
---

Comment 9 Garik Khachikyan 2012-09-18 11:40:30 UTC
scenario to reproduce:
- create provider/product/repo
- promote the product
- remove the provider
- recreate provider/product (same names)
- try to create the repo with the same name. Exception!

Comment 13 Garik Khachikyan 2012-10-03 14:55:22 UTC
# VERIFIED

there is exception showing: 
---
Provider cannot be deleted since one of its products or repositories has already been promoted. Using a changeset, please delete the repository from existing environments before deleting it.
---

doing the scenario on comment#9

checked on version:
---
katello-1.1.12-12.el6cf.noarch
katello-cli-1.1.8-6.el6cf.noarch

Comment 15 errata-xmlrpc 2012-12-04 19:46:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-1543.html

Comment 16 James Laska 2013-02-08 18:06:32 UTC
I'm seeing a very similar failure, while attempting to add a custom provider repository, whose name matches that of a custom provider repository that has since been deleted.

> 2013-02-08 12:31:50,359 [ERROR][MainThread] error() @ base.py:222 - error: Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,569

This was reproduced with the following packages ...

 * candlepin-0.7.19-3.el6cf.src.rpm
 * katello-1.1.12.2-3.el6cf.src.rpm
 * katello-candlepin-cert-key-pair-1.0-1.src.rpm
 * katello-certs-tools-1.1.8-1.el6cf.src.rpm
 * katello-cli-1.1.8-14.el6cf.src.rpm
 * katello-configure-1.1.9-13.el6cf.src.rpm
 * katello-qpid-broker-key-pair-1.0-1.src.rpm
 * katello-qpid-client-key-pair-1.0-1.src.rpm
 * katello-selinux-1.1.1-3.el6cf.src.rpm
 * pulp-1.1.15-1.el6cf.src.rpm

I don't recall observing the exception noted in comment#13

Can someone confirm that the patch has been applied to the above version of katello?

Comment 17 James Laska 2013-02-08 18:09:24 UTC
Created attachment 695202 [details]
katello-debug-20130208130639.tar.gz

Comment 18 James Laska 2013-02-08 18:28:54 UTC
Reopening based on discussion w/ bkearney on #systemengine

Comment 19 Mike McCune 2013-08-16 18:16:07 UTC
getting rid of 6.0.0 version since that doesn't exist

Comment 22 Mike McCune 2014-03-18 17:38:37 UTC
This bug was closed because of a lack of activity.  If you feel this bug should be reconsidered for attention please feel free to re-open the bug with a comment stating why it should be reconsidered.


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