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

On Saturday, April 24, 2021 at 11:53:41 AM UTC-5 Pablo Vidaurri wrote:

> 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
> On Friday, April 23, 2021 at 2:36:48 AM UTC-5 Pablo Vidaurri wrote:
>
>> 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
>>
>>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/2401df15-ab9d-4992-823d-7611018929f2n%40apereo.org.

Reply via email to