kaleidos / grails-postgresql-extensions

Grails plugin to use postgresql native elements such as arrays, hstores,...
Apache License 2.0
78 stars 63 forks source link

PooledConnection has already been closed. #98

Closed nsehgal closed 7 years ago

nsehgal commented 7 years ago

Getting this error when trying to save an ArrayType in Postgres 9.4

nsehgal commented 7 years ago

Save works for the first time, but trying again throws PooledConnection has already been closed error!!

ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper - PooledConnection has already been closed.
ERROR org.grails.web.errors.GrailsExceptionResolver - SQLException occurred when processing request: [POST] /contract/save.json
PooledConnection has already been closed.. Stacktrace follows:
java.lang.reflect.InvocationTargetException: null
    at grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter.doFilter(UpdateRequestContextHolderExceptionTranslationFilter.groovy:64)
    at grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter.doFilter(UpdateRequestContextHolderExceptionTranslationFilter.groovy:64)
    at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.groovy:53)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:62)
    at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
ilopmar commented 7 years ago

I think this has nothing to do with the plugin. It seems that there's some issue connecting with the database. Could you please repeat the same test but with a domain class without and ArrayType?

nsehgal commented 7 years ago

Thanks for the reply @ilopmar, I did the same test and it worked when there was no ArrayType save.

Versions of Hibernate and PostgreSQL Dependencies in my build.gradle

// Postgres compile 'org.postgresql:postgresql:9.4-1201-jdbc41' compile 'org.grails.plugins:postgresql-extensions:4.6.6'

//Hibernate classpath "org.grails.plugins:hibernate4:5.0.6"

compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
nsehgal commented 7 years ago

One more thing to add is my ArrayTypes are of type Enums and Strings and this happens on Querying too


 def result = xxx.withCriteria{
            eq('xxx', fullParams.xxx)
            eq('xxx', fullParams.xxx)
            pgArrayEquals 'xxx', fullParams.xxx// TODO not sure why is this throwing the Pooled Connection, after first normal run
            order("created", "asc")
            maxResults(1)
        }
ilopmar commented 7 years ago

Could you please create a small sample project that reproduce the issue, push it to github and share here the link. This way I'll be able to debug the error.

nsehgal commented 7 years ago

@ilopmar Creating a sample made it clear its not the extensions plugin for the pooled connection error. Closing this issue.Thanks for ur help.

ilopmar commented 7 years ago

Thank you for letting me know.