-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgres JDBC 42.0.0 produces tons of error logs on container startup #317
Comments
Hi @mihhail-lapushkin I think you're probably going to need to adjust the logging, really, but it's not exactly good that your only option seems to be to disable all driver logging... I wonder if anybody else has any ideas? Richard |
Could the aggressive connection retries be replaced by a more specific "up and running" check? I'm thinking of the Docker healthcheck feature, though it alone won't really fix anything. The actual fix would be to use a PostgreSQL specific check. Does it provide some built in feature? |
I've recently talked with rhuss, one of the authors of the docker-maven-plugin, since they of course face similar problems, in checking the up state of a container. He said they've gotten the best results by checking the containers's log output for a message, indicating a successful startup. This of course very much depends on container's implementation, but maybe we could simply allow the usage of a @gesellix Postgres distributes a |
@kiview how does Either way: one needs to decide whether a more generic approach (watching log output) vs. highly specific solutions (using or simulating |
I think we already planned to refactor the Currently I'd prefer to implement a |
I would also start with a generic/log based solution - specific ones can always be built on top. |
I'll start working on |
@kiview This sounds good to me, though we're really aiming to make the inheritance->composition transition at the same time as general breaking API changes for v2.0. If it can be done and make things better without changing the API for users right now, that'd be great! We collectively need to discuss the v2.0 API changes and composition model, and I'd really appreciate your input on that - it's something we should all talk about soon. For the |
I'll start with the |
One idea is to use HikariCP. Loop on getting a connection from the pool.
Behind the scenes it checks the connection is ok by doing a ping using the
binary protocol. Any exception can be caught. Thus no logging. I know this
works for MySQL. Haven't researched in PG
Just an idea
…On Sun, 2 Apr 2017 at 23:59 Kevin Wittek ***@***.***> wrote:
WaitingConsumer looks like a good match for this task, it's currently
only used for internal testing, right?
I'll start with the LogWaitStrategy for GenericContainer and see if I can
incorporate it into JdbcDatabaseContainer or PostgreSQLContainer without
breaking anything.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#317 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA8Y8dyo8RrnsS2N_iGq_oS-RK8yCGXIks5rsAwogaJpZM4MoiHn>
.
|
I assume we don't want to add a production scope HikariCP dependency to testcontainers-postgres. When looking into the Postgres log output, I've discovered that the official postgres image will restart once, before being completely ready. We basically see the following output once the database is ready:
This means a simple logline based approach won't cut it, we need multiple occurrences of |
Seems they've discovered the same problem in the docker-maven plugin and added multiline log matching: |
* Update to latest postgres jdbc driver to make error logs visible * Change PostgreSQLContainer to use WaitingConsumer for waiting instead of SQL query (#317) Fix #317 * Make OutputFrame return empty String if containing no bytes * Change PostgreSQLContainer to use LogMessageWaitStrategy (#317) Fix #317
@kiview thanks for the hint. We had similar long standing issue with Postgres image in our own code base. We are using TCP probe for waiting strategy - with sensible timeouts trying to open connection to expected service port. Once successful service is considered up and running. Only problem we have seen so far was with Postgres container while running on Linux. At the same time it was working fine on MacOS and Windows. I didn't realise the root cause was inside the container before seeing your comment above. Fix was quite simple. Wait bit more for Postgres - until n successful probes in a row. Btw. we would like to migrate to testcontainers once TestNG is supported. |
Hey @laurikimmel, great that this information could help. |
With
9.4.1212
they are produced as well, but not logged.Probably this change made them appear by default with some logging configurations:
https://www.postgresql.org/about/news/1736/
Is it something that could be fixed on your side or I should just disable all logging for PG driver?
Feels, like a bad idea...
The text was updated successfully, but these errors were encountered: