Bug 1416823 - 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: 0.9.49
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 0.9.49
Assignee: Chris "Ceiu" Rog
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: 1416824 1416825
TreeView+ depends on / blocked
 
Reported: 2017-01-26 14:38 UTC by Barnaby Court
Modified: 2020-04-15 15:09 UTC (History)
6 users (show)

Fixed In Version: candlepin-0.9.51.23-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1416824 (view as bug list)
Environment:
Last Closed: 2017-05-02 15:59:39 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin candlepin pull 1456 0 None None None 2017-01-30 13:51:13 UTC
Red Hat Bugzilla 1165193 0 unspecified CLOSED Candlepin refuses to register a consumer with a fact longer than 255 characters 2021-03-11 14:17:14 UTC

Internal Links: 1165193

Description Barnaby Court 2017-01-26 14:38:37 UTC
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:52:25 UTC
commit 8cf9431166c130cf616857d70a0bfc32c338c7df
Author: Chris Rog <crog@redhat.com>
Date:   Wed Jan 25 17:16:59 2017 -0500

    1416823: 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

Comment 4 Lukas Zapletal 2017-02-24 09:15:42 UTC
Ok thanks, when doing backup before applying the fix, I noticed:

pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
pg_dump:   cp_entitlement
pg_dump:   cp_pool
pg_dump: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.
pg_dump: NOTICE: there are circular foreign-key constraints among these table(s):
pg_dump:   cp_owner
pg_dump: You might not be able to restore the dump without using --disable-triggers or temporarily dropping the constraints.
pg_dump: Consider using a full dump instead of a --data-only dump to avoid this problem.

Is this known issue? Can't google that out.


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