Skip to content
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

Issues with ssl connection #1265

Open
nabil-mansouri opened this issue Dec 6, 2022 · 5 comments
Open

Issues with ssl connection #1265

nabil-mansouri opened this issue Dec 6, 2022 · 5 comments
Labels
Milestone

Comments

@nabil-mansouri
Copy link

nabil-mansouri commented Dec 6, 2022

Questions

We are trying to use vertx-sql-client driver with a Postgres database using SSL connection.
We have found that the driver is not working neither in a worker context neither in event loop context.

This check is failing, the verticle is loosing his context:

if (context != this.context) { throw new IllegalStateException(); }

This error occured only when this function is called "socket.upgradeToSslConnection" :

Version

Which version(s) did you encounter this bug ?

We are using vertx-sql-client 3.9.5 and vertx 3.9.5

Context

When we try to use the driver inside a worker we have an: SSL Handshake Error
We tried to use the driver without SSL connection : it works
Then we tried to use the driver in an event loop thread: it works half the time we need to restart to make it works and if we restart again it does not works

We supposed that the driver is not working with SSL (and it is worse inside a worker).

Steps to reproduce

  1. Create a verticle (prefer a worker)
  2. Configure postgres 14 using SSL connection
  3. Make any query using the driver
  4. Expect a connection failed : with a "SSL Handshake failed" error inside a worker or IllegalStateException inside event loop.

Extra

OS Version: Debian 11
JVM version: openjdk version "1.8.0_322" 64 bits
Postgres 14

@vietj
Copy link
Member

vietj commented Dec 8, 2022

can you provide a reproducer ? (e.g with docker), we do test with SSL and it works fine for us.

@vietj vietj added this to the 4.4.0 milestone Dec 8, 2022
@nabil-mansouri
Copy link
Author

nabil-mansouri commented Dec 14, 2022

can you provide a reproducer ? (e.g with docker), we do test with SSL and it works fine for us.

Hi,
thanks for your reply.

You can find here an example:
https://github.com/opendigitaleducation/pg-ssl-sample

In this project there are 3 tests cases:

shouldSucceedToInitFromEventLoop

This test calls Postgres Driver using SSL connection from a verticle running in the event loop => it works well

shouldFailToInitFromWorker

This test calls Postgres Driver using SSL connection from a verticle running in a worker => it does not work

shouldFailRandomlyToInitFromWorkerUsingBus

This test calls Postgres Driver using SSL connection from a verticle running in a worker but by delegating the call to another verticle running in event loop => it works randomly in our production environnement (but i was not able to reproduce it in my test case)

@vietj
Copy link
Member

vietj commented Dec 19, 2022

thank I will have a look

@vietj vietj self-assigned this Dec 19, 2022
@vietj
Copy link
Member

vietj commented Dec 20, 2022

actually I didn't realize until now, vertx 3 does not support correctly the PG client from a worker thread and this version support is actually ending soon (end of this year). you should upgrade to Vert.x 4 your system where we do support properly using the vertx PG client in a worker.

@vietj vietj modified the milestones: 4.4.0, 3.9.15 Dec 20, 2022
@vietj
Copy link
Member

vietj commented Dec 20, 2022

I'm leaving the bug open as it is an actual bug, I'm not saying the above to escape this of course

@vietj vietj modified the milestones: 3.9.15, 3.9.16 Feb 16, 2023
@vietj vietj removed their assignment Feb 16, 2023
@vietj vietj modified the milestones: 3.9.16, 3.9.17 May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants