A
A
Alex Fox2020-07-21 09:24:56
PostgreSQL
Alex Fox, 2020-07-21 09:24:56

An error on the findAll method or is it Connection poll?

Hello. I don’t have the strength to fight the error anymore - it happens according to the law of probability, which I can’t understand in any way -
the code is always the same, but the error is either there or not.
Database - Postgresql
Connection pool to the database - c3p0

My repository

@Repository
public interface MyEntityRepository extends CrudRepository<MyEntity, Long> {
   

    List<MyEntity> findAll(); // может так делать нельзя. сделал чтобы был List, а не Iterable
}


Next I call:

List<MyEntity> entities = myEntityRepository.findAll();


and when called, I get a huge stacktrace

o.s.t.i.TransactionInterceptor - Application exception overridden by rollback exception
javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: could not extract ResultSet
  at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
  at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1515)
  at org.hibernate.query.Query.getResultList(Query.java:132)
  at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:74)
  at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:346)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:359)
  at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:644)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:608)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595)
  at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
  at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:144)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$ExposeRepositoryInvocationInterceptor.invoke(CrudMethodMetadataPostProcessor.java:364)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
  at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
  at com.sun.proxy.$Proxy209.findAll(Unknown Source)


Caused by: org.hibernate.exception.JDBCConnectionException: could not extract ResultSet
  at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:115)
  at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
  at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)

Caused by: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:358)
  at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)
  at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)
  at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159)
  at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:109)
  at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:353)
  at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60)
  ... 230 common frames omitted
Caused by: java.net.SocketException: Connection reset
  at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:115)
  at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
  at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:431)
  at sun.security.ssl.OutputRecord.write(OutputRecord.java:417)
  at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:879)
  at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:850)
  at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
  at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
  at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
  at org.postgresql.core.PGStream.flush(PGStream.java:592)
  at org.postgresql.core.v3.QueryExecutorImpl.sendSync(QueryExecutorImpl.java:1476)
  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:329)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question