Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1416825 - Candlepin refuses to register a consumer with a fact longer than 255 characters
Summary: Candlepin refuses to register a consumer with a fact longer than 255 characters
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.0
Assignee: Chris "Ceiu" Rog
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On: 1416823 1416824
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-26 14:40 UTC by Barnaby Court
Modified: 2020-04-15 15:09 UTC (History)
6 users (show)

Fixed In Version: candlepin-2.0.24-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1416824
Environment:
Last Closed: 2017-02-01 18:18:25 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin candlepin pull 1454 0 None None None 2017-01-30 13:51:58 UTC

Description Barnaby Court 2017-01-26 14:40:51 UTC
+++ This bug was initially created as a clone of Bug #1416824 +++

+++ This bug was initially created as a clone of Bug #1416823 +++

Description of problem:
Error when updating a consumer that had guest ids & a consumer fact longer than 255 characters. 

It appears that the flush caused the updated consumer object to be written to the database before the facts could be properly updated for the 255 character limit. The manipulation to the facts (keys & values) should be happening during the conversion to object form from the incoming json. 

candlepin-0.9.49.19-1.el7.noarch        
 
2017-01-04 14:55:25,582 [req=34e428eb-fbd0-415e-886b-095d34ece66b, org=XXX] ERROR org.candlepin.common.exceptions.mappers.CandlepinExceptionMapper - Runtime Error ERROR: value too long for type character varying(255) at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse:2,157
org.postgresql.util.PSQLException: ERROR: value too long for type character varying(255)
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157) ~[postgresql-jdbc.jar:na]
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886) ~[postgresql-jdbc.jar:na]
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) ~[postgresql-jdbc.jar:na]
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555) ~[postgresql-jdbc.jar:na]
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417) ~[postgresql-jdbc.jar:na]
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363) ~[postgresql-jdbc.jar:na]
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:447) ~[c3p0-0.9.1.2.jar:0.9.1.2]
        at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1256) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.action.internal.CollectionRecreateAction.execute(CollectionRecreateAction.java:58) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:393) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:385) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:307) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:339) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1240) ~[hibernate-core-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:996) ~[hibernate-entitymanager-4.2.7.SP2-redhat-1.jar:4.2.7.SP2-redhat-1]
        at org.candlepin.model.AbstractHibernateCurator.flush(AbstractHibernateCurator.java:364) ~[AbstractHibernateCurator.class:na]
        at org.candlepin.controller.CandlepinPoolManager.revokeEntitlements(CandlepinPoolManager.java:1261) ~[CandlepinPoolManager.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
        at org.candlepin.controller.CandlepinPoolManager.revokeEntitlement(CandlepinPoolManager.java:1358) ~[CandlepinPoolManager.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
        at org.candlepin.resource.ConsumerResource.revokeGuestEntitlementsNotMatchingHost(ConsumerResource.java:1169) ~[ConsumerResource.class:na]
        at org.candlepin.guice.TransactionalInvoker.invoke(TransactionalInvoker.java:34) ~[TransactionalInvoker.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
        at org.candlepin.guice.CandlepinResourceTxnInterceptor.invoke(CandlepinResourceTxnInterceptor.java:33) ~[CandlepinResourceTxnInterceptor.class:na]
        at org.candlepin.resource.ConsumerResource.checkForGuestsUpdate(ConsumerResource.java:1096) ~[ConsumerResource.class:na]
        at org.candlepin.resource.ConsumerResource.performConsumerUpdates(ConsumerResource.java:855) ~[ConsumerResource.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
        at org.candlepin.resource.ConsumerResource.updateConsumer(ConsumerResource.java:818) ~[ConsumerResource.class:na]

Comment 1 Chris "Ceiu" Rog 2017-02-01 14:51:18 UTC
commit 92957a3f9eabb699832541031a5ebd15334886ca
Author: Chris Rog <crog@redhat.com>
Date:   Wed Jan 25 17:16:59 2017 -0500

    1416825: Abstracted out property validation to new validator framework
    
    - Added the new PropertyValidator class and its subclasses
      AttributeValidator and FactValidator, which provide implementations
      for validating attributes and facts, respectively
    - Updated the ProductCurator and ConsumerCurator to use the new
      PropertyValidator instances in place of their old private validation
      methods
    - ConsumerValidator no longer massages inbound fact data, but will
      now, instead, throw PropertyValidationExceptions when it encounters
      malformed or otherwise unmanagable data
    - ConsumerResource now provides the massaging and filtering
      functionality previously performed in the ConsumerCurator


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