You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/05/06 16:16:49 UTC

[GitHub] [pulsar] Paninka opened a new issue, #15476: JDBC Postgresql Error: This connection has been closed

Paninka opened a new issue, #15476:
URL: https://github.com/apache/pulsar/issues/15476

   **Describe the bug**
   I'm using the JDBC driver to sink Postgresql, and when Postgresql stops It says that "This connection has been closed". When Postgresql starts again the sink doesn't work and it doesn't reconnect.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   1. Start Postgresql and Pulsar
   2. Set JDBC Postgresql sink. I did this quickstart
   https://pulsar.apache.org/docs/en/io-quickstart/#connect-pulsar-to-postgresql
   3. Check if the sink is already configured and working. Start to get new messages in Pulsar
   4. Stop Postgresql instance
   5. I see this error 
   ```
   2022-05-06T15:41:06,502+0000 [pool-6-thread-1] ERROR org.apache.pulsar.io.jdbc.JdbcAbstractSink - Got exception 
   org.postgresql.util.PSQLException: This connection has been closed.
           at org.postgresql.jdbc.PgConnection.checkClosed(PgConnection.java:857) ~[postgresql-42.2.12.jar:42.2.12]
           at org.postgresql.jdbc.PgConnection.getAutoCommit(PgConnection.java:817) ~[postgresql-42.2.12.jar:42.2.12]
           at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:409) ~[postgresql-42.2.12.jar:42.2.12]
           at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369) ~[postgresql-42.2.12.jar:42.2.12]
           at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159) ~[postgresql-42.2.12.jar:42.2.12]
           at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:148) ~[postgresql-42.2.12.jar:42.2.12]
           at org.apache.pulsar.io.jdbc.JdbcAbstractSink.flush(JdbcAbstractSink.java:205) ~[pulsar-io-jdbc-core-2.9.8.jar:?]
           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
           at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
           at java.lang.Thread.run(Thread.java:829) [?:?]
   ```
   7. This is ok but when i want to start Postgresql again, the error keeps appearing and it doesn't reconnect
   8. If you want to write new messages from Pulsar to Postgres after this gets stopped and started, you have to restart the sink.
   
   Should the Pulsar sink try to reconnect to Postgresql after this stops?
   
   **Desktop (please complete the following information):**
    - OS: Ubuntu 20.04
    - Pulsar: 2.9.1
    - Postgres: 12
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] haoyann commented on issue #15476: JDBC Postgresql Error: This connection has been closed

Posted by GitBox <gi...@apache.org>.
haoyann commented on issue #15476:
URL: https://github.com/apache/pulsar/issues/15476#issuecomment-1120197920

   If want to implement reconnect feature, may be judge `connection.isClosed()` in `JdbcAbstractSink#flush`, if it has been closed,  create a new connection.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on issue #15476: JDBC Postgresql Error: This connection has been closed

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #15476:
URL: https://github.com/apache/pulsar/issues/15476#issuecomment-1153047939

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Paninka commented on issue #15476: JDBC Postgresql Error: This connection has been closed

Posted by GitBox <gi...@apache.org>.
Paninka commented on issue #15476:
URL: https://github.com/apache/pulsar/issues/15476#issuecomment-1125297178

   Thanks, I did that and now the sink reconnects after a shutdown of Postgresql. But sometimes It loses some data after this reconnection happens, I think It's because of the batch size.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org