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

Mysql cannot be connected via jdbc in macos13 #72

Closed
RemHero opened this issue Apr 27, 2024 · 1 comment
Closed

Mysql cannot be connected via jdbc in macos13 #72

RemHero opened this issue Apr 27, 2024 · 1 comment

Comments

@RemHero
Copy link

RemHero commented Apr 27, 2024

Behaviour

Steps to reproduce this issue

1.Set up Docker Buildx
- name: Set up Docker Buildx uses: crazy-max/ghaction-setup-docker@v3
2.set up

      - if: inputs.DB-name == 'MySQL' && runner.os == 'Linux'
          name: Start MySQL Service
          shell: bash
          run: |
              docker run --name mysql1 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3306:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26
              docker run --name mysql2 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3307:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26
              docker run --name mysql3 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -p 3308:3306 --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -d mysql:8.0.26

3.the jdbc code

String connUrl =
        password == null ? String.format("jdbc:%s://%s:%s/?user=%s", engine, meta.getIp(), meta.getPort(), username)
            :
            String.format(
                "jdbc:%s://%s:%s/?user=%s&password=%s",
                engine, meta.getIp(), meta.getPort(), username, password);

    try {
      Class.forName(relationalMeta.getDriverClass());
      DriverManager.getConnection(connUrl);

Expected behaviour

can connect to Mysql through jdbc

Actual behaviour

  1. all mysql are healthy
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS                   PORTS                                                  NAMES
mysql:8.0.26   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes (healthy)   33060/tcp, 0.0.0.0:3308->3306/tcp, :::3308->3306/tcp   mysql3
mysql:8.0.26   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes (healthy)   33060/tcp, 0.0.0.0:3307->3306/tcp, :::3307->3306/tcp   mysql2
mysql:8.0.26   "docker-entrypoint.s…"   3 minutes ago   Up 3 minutes (healthy)   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql1

Configuration

  • Repository URL (if public):
  • Build URL (if public):
# paste your YAML workflow file here and remove sensitive data

Logs

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
	at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:519)
	at com.mysql.cj.protocol.a.NativeProtocol.readServerCapabilities(NativeProtocol.java:475)
	at com.mysql.cj.protocol.a.NativeProtocol.beforeHandshake(NativeProtocol.java:362)
	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1350)
	at com.mysql.cj.NativeSession.connect(NativeSession.java:132)
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:948)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:818)
	... 40 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
	at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67)
	at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63)
	at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45)
	at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:513)
	... 46 more
@crazy-max
Copy link
Member

crazy-max commented Jun 6, 2024

Don't think this is related to this action. If you can provide a minimal repro that implies this is due to setting up Docker with this action that would be handy. Also post a working repro using official GitHub Runner. Closing in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants