SonarQube 4.5.7 to 5.6.5 DB Upgrade failure - sonarqube

I have attempted to upgrade our SonarQube instance from 4.5.7 LTS to 5.6.5 LTS. I followed the provided SonarQube upgrade documentation. After browsing to [sonarserver]:9000/setup and ran the DB Upgrade. The upgrade ran a little over 2 hours and came back with this message:
Upgrade Failed
Database connection cannot be established. Please check database status and JDBC settings.
When viewing the log, I see this error:
2017.02.16 13:18:43 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v50.FeedFileSources
java.lang.IllegalStateException: Error during processing of row: [uuid=AVpHrbhU29-XDi5QdhtN,uuid=AVpHrbk629-XDi5Qdh0r,data=using System;
I have copied the entire db upgrade log here: http://pastebin.com/p9CkYhrU
I also tried to restart SonarQube and attempt the db upgrade again, but it ran for 5-10 mins and reported the same result.
Additional Details:
Current SonarQube: 4.5.7 LTS
New SonarQube: 5.6.5 LTS
DB: MySQL 5.7.17
Operating System: Windows Server 2012 R2
After the unsuccessful upgrade, we reverted back to 4.5.7 successfully.
We also previously upgraded from 4.3.1 to 4.5.7 LTS. During this upgrade, we moved our SonarQube database from MySQL 5.5 to 5.7.17 and then upgraded SonarQube to 4.5.7 LTS. The upgrade step for this ran two hours and completed successfully.
Thank you for any assistance,
-Eddie

UPDATE 2/21/17
I stood up a test instance for this SonarQube upgrade on a different server. I installed MySQL 5.7 and SonarQube 4.5.7 LTS using the same backup data. During the upgrade to SonarQube 5.6.5 LTS, I received the same error as before. So I knew at this point that I could duplicate the error. I decided to look at that error message again and found these a bit further down:
Caused by: java.sql.BatchUpdateException: Packet for query is too large (6371233 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (6371233 > 4194304). You can change this value on the server by setting the `max_allowed_packet` variable.
So I went ahead and edited the max_allowed_packet variable in my.ini. First I changed it from 4M to 8M and received a similar error. Next, I changed the variable to 16M and the upgrade got past the error!
Unfortunately, the DB Upgrade ran for 11 more hours and came back with another error:
2017.02.21 02:48:13 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v564.CleanUsurperRootComponents
java.lang.IllegalStateException: Error during processing of row: [id=62566,uuid=AVpc2I0gt4GsKrhSYYYQ]
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Application was streaming results when the connection failed. Consider raising value of 'net_write_timeout' on the server.
Caused by: java.net.SocketException: Connection reset
I increased the net_read_timeout in mysql from 60 to 1200. set net_write_timeout = 1200; I restarted SonarQube, ran the DB Upgrade again, and got past the error. The upgrade continued running and I received another error:
2017.02.21 09:57:05 ERROR web[o.s.s.d.m.PlatformDatabaseMigration] DB Migration or container restart failed. Process ended with an exception java.lang.IllegalStateException: Fail to load plugin Clirr [clirr]
Caused by: java.lang.NoClassDefFoundError: org/sonar/api/batch/maven/DependsUponMavenPlugin
Caused by: java.lang.ClassNotFoundException: org.sonar.api.batch.maven.DependsUponMavenPlugin
Looks like a plugin error, so I went ahead and looked into that individual plugin. I found some information about the Clirr plugin being deprecated, so I removed it from the Plugins folder, restarted SonarQube, and got hit with another plugin error (different plugin). I got 6 or 7 of these errors and was able to fix them by either removing or replacing the .jar in the Plugins folder with the newer compatible version.
So after fixing the Java plugin, I restarted SonarQube and it started up fine! I am now running SonarQube 5.6.5 LTS on my sandbox server. The next step will be for me to revert back to 4.5.7 LTS and try the upgrade again to be sure I will have a successful production upgrade in the future.

Related

The connection to SonarQube is lost on local Sonarqube MacOS

I keep getting this error on localhost:9000 when running sonarqube community on my machine: The connection to SonarQube is lost. Please contact your system administrator after running brew service start sonarqube. I have never ran sonarqube on this machine nor have I configured anything.
Could this be a misconfiguration or is this out of my hands?
Thanks

Elasticsearch fails to start or run on OSX

I am posting to hopefully help others if they run into this issue on Mac. I recently updated ES to 2.2.x branch using Homebrew:
brew uninstall --force elasticsearch
brew update
brew install elasticsearch
I repeatedly got connection errors trying both localhost and 127.0.0.1 on port 9200.
curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
I tried an unload and load.
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Then tried starting manually.
elasticsearch
The following errors appeared indicating that the Java version 1.7.x was an error and why it would not start.
Exception in thread "main" java.lang.RuntimeException: Java version: Oracle Corporation 1.7.0_45 [Java HotSpot(TM) 64-Bit Server VM 24.45-b08] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:123)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:283)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
After getting past this error, there were errors as well for previously-installed plugins on the 1.7.x branch.
Exception in thread "main" java.lang.IllegalStateException: Could not load plugin descriptor for existing plugin [bigdesk]. Was the plugin built before 2.0?
Likely root cause: java.nio.file.NoSuchFileException: /usr/local/var/lib/elasticsearch/plugins/bigdesk/plugin-descriptor.properties
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
at java.nio.file.Files.newByteChannel(Files.java:315)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:380)
at java.nio.file.Files.newInputStream(Files.java:106)
at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:87)
at org.elasticsearch.plugins.PluginsService.getPluginBundles(PluginsService.java:378)
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:128)
at org.elasticsearch.node.Node.<init>(Node.java:146)
at org.elasticsearch.node.Node.<init>(Node.java:128)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
The solutions to these issues I discovered were the following:
Edit the /usr/local/etc/elasticsearch/elasticsearch.yml file and verify the bind_host configs are commented so it will default to 0.0.0.0.
Edit the /usr/local/Cellar/elasticsearch/YOUR_VERSION/libexec/bin/elasticsearch.in.sh file and add the -XX:-UserSuperWord flag after the other JAVA_OPTS:
JAVA_OPTS="$JAVA_OPTS -XX:-UseSuperWord"
Manually remove the previous plugins so you can install the latest versions for that ES branch:
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin list
Installed plugins in /usr/local/var/lib/elasticsearch/plugins:
- bigdesk
- head
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove bigdesk
/usr/local/Cellar/elasticsearch/2.2.0_1/libexec/bin/plugin remove head
After these steps I could once again start ES 2.x and then I can re-install any desired plugins. I hope this helps others if they run into similar issues.
I had this issue on MacOs, when I tried to uninstall elasticsearch7 and install elastisearch#6 using homebrew.
I resolved it by manually deleting the following directories and installed elasticsearch#6
Data: /usr/local/var/lib/elasticsearch/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_<<user>>.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config: /usr/local/etc/elasticsearch/
steps:
>brew uninstall elasticsearch
>rm -rf <<above mentioned directories>>
>brew install elasticsearch#6

Why the SonarQube server fails to start with following error message "Database relates to a more recent version"

I'm using Sonar 3.7.2 with JTDS driver for MSSQL database. While starting the sonar in windows gives following error:
2015.06.26 02:54:53 INFO o.s.s.p.ServerImpl SonarQube Server / 3.7.2 / 1feffde9f95897aa000a7123ba54a8c8757b40d8
2015.06.26 02:54:53 INFO o.s.c.p.Database Create JDBC datasource for jdbc:jtds:sqlserver://enbuild03/sonar;SelectMethod=Cursor
2015.06.26 02:54:54 **ERROR o.s.s.p.Platform Database relates to a more recent version of sonar. Please check your settings**.
org.sonar.api.utils.MessageException: Database relates to a more recent version of sonar. Please check your settings.
2015.06.26 02:54:57 INFO jruby.rack jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_43) [Windows Server 2008 R2-amd64-java]
2015.06.26 02:54:57 INFO jruby.rack using a shared (threadsafe!) runtime
I'm stuck here since sonar server not even starting because of the above bold error...
Any help will be appreciated ???
It somehow seems that a newer version of sonar has been run against the db you created. Can you try creating a new DB and see if that works?
If you have run some latest version of sonarqube and then downgraded the sonarqube; you are likely to get this error, if both versions are mapped to same database.
If you view the database there will be some tables in that db, once you wipe out the content of DB and restart sonarqube this error will be gone.

Elasticsearch server stops due to java.io.IOException break

I am facing problems with Elasticsearch.
I am unable to get the results. I checked in log files i got the following error:
ERROR:
2014-10-30 08:52:46,971][DEBUG][action.search.type ] [Lianda] [135] Failed to execute fetch phase
[Error: Runtime.getRuntime().exec("cd").getInputStream(): Cannot run program "cd": java.io.IOException: error=2, No such file or directory]
[Near : {... w InputStreamReader(Runtime.getRuntime().exec("cd" ....}]
Below are the version I am using:
elastic search version: 0.90.5
java version: 1.6.0_33 64 bit
plugin installed: phonetic
The strange thing is that, whenever I am getting this error, I restart the elastic search server and its works.
So I think something is getting overloaded.
Based on seeing the Runtime.getRuntime().exec() call, it could be related to a dynamic scripting vulnerability in the defaults of elastic search prior to version 1.2. See this document on scripting security.
If that is the source of your problem, you can put in a fix in your current version (or upgrade to a newer version). From the link above:
If you are running an Elasticsearch node prior to the 1.2.x release,
you can make this change on your system by putting the following
setting into elasticsearch.yml:
script.disable_dynamic: true
Then restart each node in your cluster. Dynamic scripting will now be
disabled. If you are running Elasticsearch 1.2.x or later, dynamic
scripting is already disabled by default.

Upgrade fails: Fail to execute database migration to Sonarqube 3.6.2

When I would to upgrade from Sonar 3.2 to Sonarqube 3.6.2. the upgrades fails
Int the log file I read the folowing line:
Fail to execute database migration: org.sonar.server.db.migrations.ConvertViolationsToIssues
I use a MSSQL database, I read that someone got exactly the same error when he wanted to upgrade using an Oracle 10g database. I read that this problem will be solved in 3.7. Is this also applying to my problem? When 3.7 will be realeased?
With kind regards.
Your issue indeed looks like 2 other ones listed on stackoverflow:
Sonar-Upgrade from 3.5.1 to 3.6.2 failed
upgrade from sonarqube 3.5.1 to 3.6.2 fails on migration of postgres db
(would need more log to be sure, but I'm almost 100% sure)
So indeed, it will be fixed with SONAR-4542 that will be shipped with SonarQube 3.7, expected in a couple of days from now (around August 9th).

Resources