Bug 1402978

Summary: You can't operate on a closed ResultSet!!!
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Chris "Ceiu" Rog <crog>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 2.0CC: bcourt, crog, khowell, redakkan, skallesh
Target Milestone: ---Keywords: Triaged
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-2.0.22-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-20 15:46:04 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:

Description John Sefler 2016-12-08 19:36:58 UTC
Description of problem:
Automated testing of ActivationKeys is hitting an error when trying to GET all the activation keys from candlepin API.  The json returned is missing a closing backet ] character.  The candlepin.log contains this ERROR:
 
2016-12-08 14:27:24,253 [thread=http-bio-8443-exec-10] [req=310b1bc9-6ae3-4391-9bb1-190c8accd34d, org=] ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - You can't operate on a closed ResultSet!!!

Version-Release number of selected component (if applicable):
[root@jsefler-candlepin candlepin]# git log | head -1
commit 69f7f5114a425513ec0fb2d2f61fca2010e9fb0

How reproducible:
not sure

Steps to Reproduce:
[root@jsefler-candlepin candlepin]# curl --stderr /dev/null --insecure --user admin:admin --request GET 'https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/activation_keys'

When you curl that ^ command, the json string returned is missing a closing bracket ] making the result unparsable.

I'll past the exact result in a subsequent comment.


Actual results:
  incomplete json

Expected results:
  complete json

Additional info:
  This could be affecting other candlepin API calls too.  Chris Rog says...

<crog> jsefler, these are all the objects that are output using the same method: ActivationKey, Cdn, CertificateSerial, ConsumerType, ContentData, DeletedConsumer, Environment, JobStatus, Content, ProductData, ImportRecord, Consumer, Owner

Comment 1 John Sefler 2016-12-08 19:41:12 UTC
[root@jsefler-candlepin candlepin]# curl --stderr /dev/null --insecure --user admin:admin --request GET 'https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/activation_keys'
[{"id":"8a90860f58acd6ba0158df9c2ca24208","name":"testuser1_admin-ActivationKey1481220303990","description":null,"owner":{"id":"8a90860f58acd6ba0158acd7e7030002","key":"admin","displayName":"Admin Owner","href":"/owners/admin"},"pools":[{"id":"8a90860f58acd6ba0158df9c3372420a","pool":{"id":"8a90860f58acd6ba0158acd831ea02fe","type":"NORMAL","owner":{"id":"8a90860f58acd6ba0158acd7e7030002","key":"admin","displayName":"Admin Owner","href":"/owners/admin"},"activeSubscription":true,"quantity":20,"startDate":"2016-11-28T00:00:00+0000","endDate":"2017-11-28T00:00:00+0000","attributes":[],"contractNumber":"1","accountNumber":"12331131231","orderNumber":"order-8675309","consumed":0,"exported":0,"branding":[{"productId":"32060","name":"Branded Admin OS Instance Based one socket","type":"OS","created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"}],"productAttributes":[{"name":"instance_multiplier","value":"2","entityVersion":-2030932668,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"sockets","value":"1","entityVersion":1498458080,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"virt_limit","value":"1","entityVersion":-470549895,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"host_limited","value":"true","entityVersion":1588434360,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"stacking_id","value":"15","entityVersion":-871702637,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"multi-entitlement","value":"yes","entityVersion":625834455,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"support_level","value":"Standard","entityVersion":1771842784,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"support_type","value":"L1-L3","entityVersion":-1005010536,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"version","value":"1.0","entityVersion":-102204262,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"variant","value":"ALL","entityVersion":105724093,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"arch","value":"ALL","entityVersion":219409238,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"},{"name":"type","value":"MKT","entityVersion":261261135,"created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000"}],"productName":"Admin OS Instance Based one socket","productId":"adminos-onesocketib","stacked":true,"stackId":"15","developmentPool":false,"derivedProductAttributes":[],"href":"/pools/8a90860f58acd6ba0158acd831ea02fe","created":"2016-11-28T21:29:59+0000","updated":"2016-11-28T21:29:59+0000","providedProducts":[{"productId":"32060","productName":"Awesome OS Instance Server Bits"},{"productId":"5050","productName":"Admin OS Premium Architecture Bits"},{"productId":"5051","productName":"Admin OS Developer Bits"}],"derivedProvidedProducts":[],"subscriptionSubKey":"master","subscriptionId":"10"},"quantity":1,"created":"2016-12-08T18:05:05+0000","updated":"2016-12-08T18:05:05+0000"}],"products":[],"contentOverrides":[],"releaseVer":{"releaseVer":null},"serviceLevel":null,"autoAttach":null,"created":"2016-12-08T18:05:04+0000","updated":"2016-12-08T18:05:04+0000"}



When I pipe the response through a json tool, it complains about the final character.  That's how I found the missing closing bracket.
[root@jsefler-candlepin candlepin]# curl --stderr /dev/null --insecure --user admin:admin --request GET 'https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/activation_keys' | python -m json.tool
Expecting object: line 1 column 3405 (char 3404)

Comment 2 Chris "Ceiu" Rog 2016-12-13 14:03:20 UTC
commit 0093c3935f18b7fc42e4d044c7526f063043185b
Author: Chris Rog <crog>
Date:   Fri Dec 9 13:32:26 2016 -0500

    CandlepinQueryInterceptor now uses a separate session for cursors
    
    - CandlepinQueryInterceptor now uses its own session for streaming the
      query results
    - Added additional spec tests for testing streaming certain entities