[JIRA] (HSEARCH-4722) Fix postgresql container start timing out on CI
by Yoann Rodière (JIRA)
Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate Search ( https://hibernate.atlassian.net/browse/HSEARCH?atlOrigin=eyJpIjoiYTk4ZDdh... ) / Task ( https://hibernate.atlassian.net/browse/HSEARCH-4722?atlOrigin=eyJpIjoiYTk... ) HSEARCH-4722 ( https://hibernate.atlassian.net/browse/HSEARCH-4722?atlOrigin=eyJpIjoiYTk... ) Fix postgresql container start timing out on CI ( https://hibernate.atlassian.net/browse/HSEARCH-4722?atlOrigin=eyJpIjoiYTk... )
Issue Type: Task Assignee: Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) Components: build Created: 18/Oct/2022 00:07 AM Fix Versions: 6.2-backlog, 6.0.11.Final, 6.1.8.Final Priority: Major Reporter: Yoann Rodière ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
In https://hibernate.atlassian.net/browse/HSEARCH-4684 ( https://hibernate.atlassian.net/browse/HSEARCH-4684 ) , we introduced a workaround to accurately detect that postgres really was up. In essence we would wait for postgres to tell us it’s ready twice , because for some reason it would, and the first time it wasn’t really ready.
Fast-forward to today, and postgres no longer tells us it’s ready twice:
[INFO] DOCKER> [postgres:13.1] "postgres": Start container 3d9c2fe7efa7
15:12:38.722 PostgreSQL:The files belonging to this database system will be owned by user "postgres".
15:12:38.722 PostgreSQL:This user must also own the server process.
15:12:38.723 PostgreSQL:The database cluster will be initialized with locale "en_US.utf8".
15:12:38.723 PostgreSQL:The default database encoding has accordingly been set to "UTF8".
15:12:38.723 PostgreSQL:The default text search configuration will be set to "english".
15:12:38.723 PostgreSQL:Data page checksums are disabled.
15:12:38.723 PostgreSQL:fixing permissions on existing directory /var/lib/postgresql/data ... ok
15:12:38.723 PostgreSQL:creating subdirectories ... ok
15:12:38.723 PostgreSQL:selecting dynamic shared memory implementation ... posix
15:12:38.737 PostgreSQL:selecting default max_connections ... 100
15:12:38.754 PostgreSQL:selecting default shared_buffers ... 128MB
15:12:38.767 PostgreSQL:selecting default time zone ... Etc/UTC
15:12:38.771 PostgreSQL:creating configuration files ... ok
15:12:38.912 PostgreSQL:running bootstrap script ... ok
15:12:39.594 PostgreSQL:performing post-bootstrap initialization ... ok
15:12:44.781 PostgreSQL:syncing data to disk ... ok
15:12:44.782 PostgreSQL:initdb: warning: enabling "trust" authentication for local connections
15:12:44.782 PostgreSQL:You can change this by editing pg_hba.conf or using the option -A, or
15:12:44.782 PostgreSQL:--auth-local and --auth-host, the next time you run initdb.
15:12:44.782 PostgreSQL:Success. You can now start the database server using:
15:12:44.782 PostgreSQL: pg_ctl -D /var/lib/postgresql/data -l logfile start
15:12:44.900 PostgreSQL:waiting for server to start....2022-10-17 15:12:44.900 UTC [47] LOG: starting PostgreSQL 13.1 (Debian 13.1-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
15:12:44.902 PostgreSQL:2022-10-17 15:12:44.902 UTC [47] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
15:12:44.910 PostgreSQL:2022-10-17 15:12:44.909 UTC [48] LOG: database system was shut down at 2022-10-17 15:12:39 UTC
15:12:44.914 PostgreSQL:2022-10-17 15:12:44.914 UTC [47] LOG: database system is ready to accept connections
15:12:44.992 PostgreSQL: done
15:12:44.992 PostgreSQL:server started
[ERROR] DOCKER> [postgres:13.1] "postgres": Timeout after 10034 ms while waiting on log out '(?s)ready to accept connections.*ready to accept connections'
[ERROR] DOCKER> IO Error while requesting logs: org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected Thread-6
[ERROR] DOCKER> Error occurred during container startup, shutting down...
See https://ci.hibernate.org/blue/organizations/jenkins/hibernate-search/deta... ( https://ci.hibernate.org/blue/organizations/jenkins/hibernate-search/deta... )
I don’t know what’s going on, but we need to have another look.
Maybe simply upgrading to the latest postgres would lead to a more… stable… behavior?
( https://hibernate.atlassian.net/browse/HSEARCH-4722#add-comment?atlOrigin... ) Add Comment ( https://hibernate.atlassian.net/browse/HSEARCH-4722#add-comment?atlOrigin... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100209- sha1:597f6a7 )
2 years, 2 months
[JIRA] (HHH-15608) Error In Native Query where column is mapped twice
by Mike Conner (JIRA)
Mike Conner ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=62fe3d3... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNTFjNTlhYzAx... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-15608?atlOrigin=eyJpIjoiNTFjNT... ) HHH-15608 ( https://hibernate.atlassian.net/browse/HHH-15608?atlOrigin=eyJpIjoiNTFjNT... ) Error In Native Query where column is mapped twice ( https://hibernate.atlassian.net/browse/HHH-15608?atlOrigin=eyJpIjoiNTFjNT... )
Issue Type: Bug Affects Versions: 6.1.3 Assignee: Unassigned Attachments: hibernateNativeQueryBug.zip Components: query-sql Created: 17/Oct/2022 12:45 PM Environment: hibernate 6.1.3
openjdk version "17.0.4" 2022-07-19 LTS
Windows 10
Originally Oracle 19c, but duplicated in H2 as a unit test
Priority: Major Reporter: Mike Conner ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=62fe3d3... )
I’m in the process of upgrading a project using Hibernate ORM from 5.3.14 to 6.1.3. I’ve got a SQLQuery that I’ve moved to NativeQuery, and am now getting the error:
jakarta.persistence.PersistenceException: Converting `org.hibernate.exception.SQLGrammarException` to JPA `PersistenceException` : Unable to find column position by name: title4_0_0_
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:165)
at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:374)
at org.hibernate.bugs.H2HibernateTest.testNativeQueryWithEntity(H2HibernateTest.java:83)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.hibernate.exception.SQLGrammarException: Unable to find column position by name: title4_0_0_
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:64)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:56)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)
at org.hibernate.sql.results.jdbc.internal.AbstractResultSetAccess.resolveColumnPosition(AbstractResultSetAccess.java:67)
at org.hibernate.query.results.dynamic.DynamicFetchBuilderStandard.lambda$buildFetch$0(DynamicFetchBuilderStandard.java:94)
at org.hibernate.query.results.DomainResultCreationStateImpl.resolveSqlExpression(DomainResultCreationStateImpl.java:266)
at org.hibernate.query.results.dynamic.DynamicFetchBuilderStandard.lambda$buildFetch$1(DynamicFetchBuilderStandard.java:91)
at org.hibernate.metamodel.mapping.internal.BasicAttributeMapping.forEachSelectable(BasicAttributeMapping.java:363)
at org.hibernate.metamodel.mapping.ModelPart.forEachSelectable(ModelPart.java:93)
at org.hibernate.query.results.dynamic.DynamicFetchBuilderStandard.buildFetch(DynamicFetchBuilderStandard.java:108)
at org.hibernate.query.results.DomainResultCreationStateImpl.lambda$visitFetches$2(DomainResultCreationStateImpl.java:408)
The query is:
NativeQuery query = session.createNativeQuery( "select /* findExampleBooks */ {book.*} from zbook_t book" );
The sql output by hibernate is below. Note the duplicated zpublish_3_0_0_:
select
/* findExampleBooks */ book.ZBOOK_PK zbook_pk1_0_0_,
book.DESCRIPTION descript2_0_0_,
book.ZPUBLISHER_FK zpublish3_0_0_,
book.TITLE zpublish3_0_0_
from
zbook_t book
This appears to be due to the fact that we map the same column twice:
@ManyToOne(targetEntity = ZPublisher.class, fetch = FetchType.LAZY)
@JoinColumn(name = "ZPUBLISHER_FK" )
private ZPublisher publisher;
@Column(name = "ZPUBLISHER_FK" , nullable = false , insertable = false , updatable = false )
@Access(AccessType.FIELD)
private Long publisherFk;
If I either remove foreign key mappings, or remove the braces in the sql, which expands the attributes, then the problem goes away.
I only understood that it was due to the braces expansion as I was writing this up. In our case, I think we can just remove the braces in the sql, since we only return one entity in the cases where we map the results to an entity.
( https://hibernate.atlassian.net/browse/HHH-15608#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-15608#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100209- sha1:13f5f09 )
2 years, 2 months