Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket 7.6.0 not connecting to MySQL 8.0

Edited

I am trying to upgrade our old Bitbucket instance to the new 7.6.0 version. I can't pass the database setup because it can't connect to MySQL 8.0.21. Both Bitbucket and MySQL run in separate Docker containers. New instances of Jira and Confluence (those too are running in separate Docker containers) can connect normaly without too much trouble.

This is the error:

The configuration entered is not valid. A database connection could not be established. Please check your configuration and try again.
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:217)
	com.atlassian.stash.internal.migration.DefaultDatabaseMigrationService.validateConfiguration(DefaultDatabaseMigrationService.java:85)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	...
Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 4 milliseconds ago.  The last packet sent successfully to the server was 4 milliseconds ago.
	org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
	com.atlassian.stash.internal.db.DefaultDatabaseValidator.validate(DefaultDatabaseValidator.java:43)
	com.atlassian.stash.internal.db.DefaultDatabaseManager.validateConfiguration(DefaultDatabaseManager.java:214)
	...
Communications link failure

The last packet successfully received from the server was 4 milliseconds ago.  The last packet sent successfully to the server was 4 milliseconds ago.
	sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	...
Received fatal alert: protocol_version
	sun.security.ssl.Alerts.getSSLException(Alerts.java:214)
	sun.security.ssl.Alerts.getSSLException(Alerts.java:159)
	sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2041)
	...

 

2 answers

0 votes
Aaron Atlassian Team Oct 09, 2020

Hey @Fabrizio Santini!

 

A few things stand out to me here that make this a bit tricky.

 

I am trying to upgrade our old Bitbucket instance to the new 7.6.0 version. I can't pass the database setup

A regular upgrade should not bring you to the database setup page. If you are doing a test upgrade of an already existing instance, you won't need to set up the DB connection again. If you are getting that page it means that either:

  1. Your Bitbucket home was changed and you are not pointing to the correct database
  2. Your bitbucket.properties file is not readable/move/no longer exists.

 

If you are just trying to install a fresh 7.6.0 instance than the above can be ignored. Otherwise, you need to make sure your Bitbucket home and shared directory are where you expect them to be.

 

Onto the error itself.

Received fatal alert: protocol_version
 sun.security.ssl.Alerts.getSSLException(Alerts.java:214)
 sun.security.ssl.Alerts.getSSLException(Alerts.java:159)
 sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2041)

 

This is an SSL error being thrown to Bitbucket. I haven't seen anything specific to Bitbucket, but I did come across https://support.huaweicloud.com/intl/en-us/trouble-rds/rds_12_0005.html

 

So some possibilities are:

  1. JVM is too old to use the correct cipher suite.
  2. JVM isn't using the right cipher suite.
  3. Misconfigured MySQL expecting incorrect information.

 

So what can we do?

  1. The easiest thing to do if possible would be to not use SSL for the MySQL connection. At the very least you'll get a different error if something is still configured incorrectly.
  2. Based on the above document you could upgrade your system Java.
  3. You could also try to add "-Dhttps.protocols=TLSv1.2" to the _start-webapp.sh file on the JVM_SUPPORT_RECOMMENDED_ARGS line (note you will have to uncomment that line). This assumes MySQL is expecting TLSv1.2. I don't know if that is the case for your environment.

 

I hope this helps!

 

Regards,
Aaron Levinson
Dev Tools Support Engineer

0 votes
Ana Retamal Atlassian Team Oct 09, 2020

Hi @Fabrizio Santini, thanks for reaching out!

Please note that while MySQL is supported by Bitbucket Server, it's currently not recommended especially in larger instances, due to inherent performance and deadlock issues that occur in this database engine under heavy load. You can see Connecting Bitbucket Server to MySQL for more information.

That said, let's look at a few things to make sure the configuration has been set correctly. First, let's start by making sure that the Bitbucket container is able to see the MySQL container on the network. You can check if the container is on the same docker network and try a ping or telnet to confirm if they can reach each other.

Secondly, you'd also need to review if your MySQL setup is allowing connections from all the hosts on the network, as it's possible to restrict which IP addresses are able to connect to MySQL.
We also suggest that you check the steps in this thread
I hope the recommendations below help you, Fabrizio! If it does, please mark the answer as accepted so other people can find it. If it doesn't, let us know what were the results you got so we can continue troubleshooting your issue.
Best regards,
Ana

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.6.0
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,850 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you