Bug 1033583

Summary: Got “Runtime JDBC Error” while adding repo-overrides exceeding 255 chars.
Product: [Community] Candlepin Reporter: spandey
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: bkearney, jesusr, jsefler, kbanerje, spandey
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-29 19:05:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 863175    

Description spandey 2013-11-22 12:43:24 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
4/4

Prerequisites:
Rhel7 with following subscription-manager rpm 
subscription-manager-gui-1.10.7-1.git.0.15d737b.el7.x86_64
subscription-manager-firstboot-1.10.7-1.git.0.15d737b.el7.x86_64
subscription-manager-migration-1.10.7-1.git.0.15d737b.el7.x86_64
subscription-manager-migration-data-2.0.5-1.git.0.3be2ad4.el7.noarch
subscription-manager-1.10.7-1.git.0.15d737b.el7.x86_64

Steps to Repro : 
Register client to candlepin subscribe instance based subscription . 
Add repo-override for content-label using following command 

[root@localhost ~]# subscription-manager repo-override --repo content-label --add test233333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333:0

Expected Result : 
Proper message should display like : invalid parameters   

Actual Result : 
Runtime Error Could not execute JDBC batch update at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598

Comment 2 John Sefler 2013-12-09 16:08:39 UTC
A similar error is thrown when the added override value exceeds 255 chars...


[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo1 --add=param:value_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
Runtime Error Batch entry 0 update cp_consumer_content_override set created='2013-12-09 11:03:23.169000 -05:00:00', updated='2013-12-09 11:04:42.821000 -05:00:00', consumer_id='8a90874042bf59cd0142c9fe0de12d1c', content_label='repo1', name='param', value='value_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456' where id='8a90874042bf59cd0142d81941a1401a' was aborted.  Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598



[root@jsefler-7 ~]# tail -f /var/log/rhsm/rhsm.log
2013-12-09 11:04:42,651 [DEBUG] subscription-manager @connection.py:444 - Making request: PUT /candlepin/consumers/ad3dfd41-8940-42c9-b654-13e79d9cfe95/content_overrides
2013-12-09 11:04:42,836 [DEBUG] subscription-manager @connection.py:467 - Response: status=500
2013-12-09 11:04:42,838 [ERROR] subscription-manager @managercli.py:156 - exception caught in subscription-manager
2013-12-09 11:04:42,839 [ERROR] subscription-manager @managercli.py:157 - Runtime Error Batch entry 0 update cp_consumer_content_override set created='2013-12-09 11:03:23.169000 -05:00:00', updated='2013-12-09 11:04:42.821000 -05:00:00', consumer_id='8a90874042bf59cd0142c9fe0de12d1c', content_label='repo1', name='param', value='value_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456' where id='8a90874042bf59cd0142d81941a1401a' was aborted.  Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 82, in <module>
    sys.exit(abs(main() or 0))
  File "/usr/sbin/subscription-manager", line 73, in main
    return managercli.ManagerCLI().main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2417, in main
    return CLI.main(self)
  File "/usr/share/rhsm/subscription_manager/cli.py", line 166, in main
    return cmd.main()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 453, in main
    return_code = self._do_command()
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 2299, in _do_command
    raise ex
RestlibException: Runtime Error Batch entry 0 update cp_consumer_content_override set created='2013-12-09 11:03:23.169000 -05:00:00', updated='2013-12-09 11:04:42.821000 -05:00:00', consumer_id='8a90874042bf59cd0142c9fe0de12d1c', content_label='repo1', name='param', value='value_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456' where id='8a90874042bf59cd0142d81941a1401a' was aborted.  Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError:2,598

Comment 4 Carter Kozak 2014-01-02 15:08:50 UTC
commit d333911a3bd91116855cec7f03632cc92ae260ea
Author: ckozak <ckozak>
Date:   Mon Dec 23 12:50:05 2013 -0500

    1033583: add messaging when override name/value are too long

Comment 5 John Sefler 2014-03-03 19:00:51 UTC
Verifying Version...
[root@jsefler-7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.4-1
subscription-manager: 1.10.14-3.el7
python-rhsm: 1.10.12-1.el7


[root@jsefler-7 ~]# subscription-manager register
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: 3f8794fc-c19a-47d0-a734-9f6599a2761c 

[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo_67890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 --add=param:value
Name, value, and label of the override must not exceed 255 characters.

[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo --add=param_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456:value
Name, value, and label of the override must not exceed 255 characters.

[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo --add=param:value_7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
Name, value, and label of the override must not exceed 255 characters.

[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo --add=param:value
Repository 'repo' does not currently exist, but the override has been added.
[root@jsefler-7 ~]# subscription-manager repo-override --list
Repository: repo
  param: value


VERIFIED: Attempts to create repo overides with a name, value, and label that exceed 255 chars is gracefully blocked.

Comment 7 Bryan Kearney 2014-09-29 19:05:22 UTC
These bugs were fixed during 7.0 but not moved to CLOSED. They have been delivered