CAS 6.3.2 with postgres giving exceptions

80 views
Skip to first unread message

Pablo Vidaurri

unread,
Apr 23, 2021, 3:36:48 AM4/23/21
to CAS Community
Mostly out of the box, no custom code. Just using OAuth server for now. Have the following dependencies, some of which I did not think i needed but CAS was complaining of missing classes:

 implementation "org.apereo.cas:cas-server-support-jdbc-drivers:${project.'cas.version'}"
    implementation "org.apereo.cas:cas-server-support-jpa-ticket-registry:${project.'cas.version'}"
    implementation "org.apereo.cas:cas-server-support-json-service-registry:${project.'cas.version'}"    
    implementation "org.apereo.cas:cas-server-support-ldap:${project.'cas.version'}"
    implementation "org.apereo.cas:cas-server-support-oauth-webflow:${project.'cas.version'}"
    implementation "org.apereo.cas:cas-server-support-saml-core-api:${project.'cas.version'}"

Getting following two exception, after a while get a 400 response requiring me to restart CAS.

2021-04-22 20:53:20,823 DEBUG [org.apereo.cas.ticket.registry.JpaTicketRegistry] - <Updated ticket [TGT-20-*****oZvIWvZGI-my.server.com].>
2021-04-22 20:53:20,824 ERROR [org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController] - <Could not identify and extract access token request>
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : org.apereo.cas.ticket.accesstoken.OAuth20DefaultAccessToken.ticketGrantingTicket -> org.apereo.cas.ticket.TicketGrantingTicketImpl; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : org.apereo.cas.ticket.accesstoken.OAuth20DefaultAccessToken.ticketGrantingTicket -> org.apereo.cas.ticket.TicketGrantingTicketImpl
        at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:371) ~[spring-orm-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:257) ~[spring-orm-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538) ~[spring-orm-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743) ~[spring-tx-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711) ~[spring-tx-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:633) ~[spring-tx-5.2.12.RELEASE.jar:5.2.12.RELEASE]
        .
        .
        .
  Caused by: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : org.apereo.cas.ticket.accesstoken.OAuth20DefaultAccessToken.ticketGrantingTicket -> org.apereo.cas.ticket.TicketGrantingTicketImpl
        at org.hibernate.engine.spi.CascadingActions$8.noCascade(CascadingActions.java:379) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:167) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:158) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:148) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:81) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:102) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1362) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:453) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3212) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2380) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:447) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:183) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]
        .
        .
        .

2nd exception:

[[36m2021-04-23 00:19:31,033 DEBUG [org.apereo.cas.ticket.registry.support.JpaLockingStrategy] - <[my.company.com] trying to acquire [cas-ticket-registry-cleaner] lock.>^[[m
^[[33m2021-04-23 00:19:34,027 WARN [com.zaxxer.hikari.pool.ProxyLeakTask] - <Connection leak detection triggered for org.postgresql.jdbc.PgConnection@4d68d41 on thread scheduling-1, stack trace follows>^[[m
java.lang.Exception: Apparent connection leak detected
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128) ~[HikariCP-3.4.5.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

Dont feel good about it already not working out of the box.

Thanks
-psv

Pablo Vidaurri

unread,
Apr 24, 2021, 12:53:41 PM4/24/21
to CAS Community
Is there a way to set cascading via  cas.property?

Trying to resolve:
2021-04-22 20:53:20,824 ERROR [org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController] - <Could not identify and extract access token request>
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : org.apereo.cas.ticket.accesstoken.OAuth20DefaultAccessToken.ticketGrantingTicket -> org.apereo.cas.ticket.TicketGrantingTicketImpl; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : org.apereo.cas.ticket.accesstoken.OAuth20DefaultAccessToken.ticketGrantingTicket -> org.apereo.cas.ticket.TicketGrantingTicketImpl

Happens when requesting an oauth token everyonce in a while wich produces a 400 response. Happens often enough that users are complaining.

-psv

Pablo Vidaurri

unread,
Apr 24, 2021, 1:57:55 PM4/24/21
to CAS Community, Pablo Vidaurri
I commented out my healthQuery config, because HikariCP docs said it was only needed for legacy drivers not supporting JDBC4. This seems to have resolved my issue. I have generated over 1000 OAuth tokens and have not seen the "save the transient instance before flushing" issue. I will continue to monitor. But this this make sense?

# cas.ticket.registry.jpa.healthQuery=SELECT 1

Pablo Vidaurri

unread,
Apr 24, 2021, 3:24:52 PM4/24/21
to CAS Community, Pablo Vidaurri
Errors started appearing again so health query string was not it
Reply all
Reply to author
Forward
0 new messages