Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Resilience against 3DCityDB downtime #1

Open
BWibo opened this issue Jan 15, 2018 · 3 comments
Open

Resilience against 3DCityDB downtime #1

BWibo opened this issue Jan 15, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@BWibo
Copy link
Member

BWibo commented Jan 15, 2018

Currently, the 3dcitydb-wfs-container will fail at startup, if the 3dcitydb instance it tries to connect to is not reachable for any reason. This is especially unfavorable when I try to start a 3dcitydb container and a 3dcitydg-wfs container linked to it using docker-compose.

Following exception is thrown:

15-Jan-2018 16:58:26.295 SEVERE [localhost-startStop-1] org.postgresql.Driver.connect Connection error:
 org.postgresql.util.PSQLException: The connection attempt failed.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
        at org.postgresql.Driver.makeConnection(Driver.java:450)
        at org.postgresql.Driver.connect(Driver.java:252)
...
...
...
15-Jan-2018 16:58:26.301 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial connections of pool.
 org.postgresql.util.PSQLException: The connection attempt failed.
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
        at org.postgresql.Driver.makeConnection(Driver.java:450)
        at org.postgresql.Driver.connect(Driver.java:252)
...
...
...        

Is it possible to make the wfs retry to connect for a certain period of time when starting (@clausnagel )?

After looking at the Optional database connection settings like maxWait etc. in the wfs documentation
I am not entirely sure how to configure the wfs properly to behave as described above, if this is possible with the optional connection settings.

Another option would be to use a wrapper script in the 3dcitydb-wfs image, that checks if the database is ready to accept connections, as described here:
https://docs.docker.com/compose/startup-order/
However, there are several drawbacks with this option (e.g. psql and sqlplus requried in the image) and I would like to avoid that.
Big thanks ind advance!

@BWibo BWibo added the enhancement New feature or request label Jan 15, 2018
@BWibo BWibo self-assigned this Jan 15, 2018
@BWibo BWibo added the help wanted Extra attention is needed label Jan 15, 2018
@clausnagel
Copy link
Collaborator

Thanks for reporting this issue. I will take a look at it and post my findings here. A wrapper script should not be necessary.

The WFS uses a Tomcat Connection Pool in the background. This documentation provides more information about the available connection settings.

@BWibo
Copy link
Member Author

BWibo commented Feb 23, 2018

For now this issue is temporarily resolved in b76e925 using a wrapper script (wait-for-psql.sh).

@clausnagel
Copy link
Collaborator

Adapted the WFS to connect to the database in a more lazy way. So if the connection cannot be established at service startup, there is no fatal exception anymore. Let me know if this version works better for your docker image.

Commit of the changes: 3dcitydb/web-feature-service@ff863cd

If you need help in building the WAR, let me know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants