jcabi / jcabi-mysql-maven-plugin

MySQL Maven Plugin: starts MySQL server on pre-integration phase and shuts it down on post-integration phase
https://mysql.jcabi.com
Other
35 stars 27 forks source link

Cannot run program ".../mysqld" #45

Open yegor256 opened 9 years ago

yegor256 commented 9 years ago

The build is broken for a very strange reason, see http://www.rultor.com/t/934-60200725 (for example).

[info] $ /home/vagrant/jcabi-mysql-maven-plugin/target/mysql-dist/scripts/mysql_install_db --defaults-file=/tmp/1414050373727-0/my-default.cnf --force --innodb_use_native_aio=0 --datadir=/tmp/1414050373727-0/data --basedir=/home/vagrant/jcabi-mysql-maven-plugin/target/mysql-dist
[warn] >> sh: 1: /home/vagrant/jcabi-mysql-maven-plugin/target/mysql-dist/bin/my_print_defaults: not found
[warn] >> sh: 1: /home/vagrant/jcabi-mysql-maven-plugin/target/mysql-dist/bin/mysqld: not found

Let's investigate and fix

yegor256 commented 9 years ago

@dmarkov please assign @longtimeago to this problem

dmarkov commented 9 years ago

I'll find a developer for the task soon...

dmarkov commented 9 years ago

thank you for the ticket reported, I topped your account for 15 mins, transaction 000-69630965

dmarkov commented 9 years ago

@dmarkov please assign @longtimeago to this problem

@yegor256 OK @longtimeago please start, the task is yours

longtimeago commented 9 years ago

@yegor256 First of all, I can't reproduce the issue. I have very weird issue with libaio.so.1 (as I mentioned here https://github.com/jcabi/jcabi-mysql-maven-plugin/issues/43)

The problem was very funny: looks like content of mysql-dist-5.6.21-linux-amd64.zip was wrong. mysqld inside it depends on system shared libs from /lib/i386-linux-gnu.

When I rename mysql-dist-5.6.21-linux-x86.zip to mysql-dist-5.6.21-linux-amd64.zip I made a progress. I don't understand why you had no issue with that on CI PC

longtimeago commented 9 years ago

here is PR for review https://github.com/jcabi/jcabi-mysql-maven-plugin/pull/46

longtimeago commented 9 years ago

@yegor256 I'm sorry but I can't figure out what's the problem. Looks like mysql-dist-5.6.21-linux-amd64.zip partially unzipped or didn't unzip at all. Can't reproduce the issue on my local PC

yegor256 commented 9 years ago

@longtimeago you can't reproduce or you can't fix?

longtimeago commented 9 years ago

@yegor256 Can't reproduce the issue on my local PC

yegor256 commented 9 years ago

@dmarkov please assign someone else

longtimeago commented 9 years ago

@yegor256 This issue might be related to https://github.com/jcabi/jcabi-mysql-maven-plugin/issues/47

dmarkov commented 9 years ago

@dmarkov please assign someone else

@yegor256 someone else will help in this task, no problem at all

mfulton26 commented 9 years ago

Any update on this? I can't use this plugin unless there is a previous version that works.

[ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://www.jcabi.com/jcabi-aspects/jsr-303.html) ... [INFO] >> FATAL ERROR: Could not find /Users/mfulton/git/idx/metric/acceptance/target/mysql-dist/bin/my_print_defaults

yegor256 commented 9 years ago

@mfulton26 for now you can use mysql-dist version 5.6.14, it works without problems (with the latest version of the plugin)

mfulton26 commented 9 years ago

@yegor256 I see the same with version 5.6.14 with mysql.classifier mac-x86_64.

yegor256 commented 9 years ago

hm.. works fine for me with 5.6.14 on Mac. Can you show your pom.xml and your Maven/Java versions?

mfulton26 commented 9 years ago

@yegor256 As requested see below.

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
...
    <properties>
...
        <mysql.port>3306</mysql.port>
    </properties>

    <build>
...
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.jcabi</groupId>
                                    <artifactId>mysql-dist</artifactId>
                                    <version>5.6.14</version>
                                    <!--suppress MavenModelInspection -->
                                    <classifier>${mysql.classifier}</classifier>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/mysql-dist</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.jcabi</groupId>
                <artifactId>jcabi-mysql-maven-plugin</artifactId>
                <version>0.9</version>
                <executions>
                    <execution>
                        <id>mysql-test</id>
                        <goals>
                            <goal>classify</goal>
                            <goal>start</goal>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <port>${mysql.port}</port>
                            <data>${project.build.directory}/mysql-data</data>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <mysql.port>${mysql.port}</mysql.port>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <deployables>
                        <deployable>
                            <properties>
                                <context>ROOT</context>
                            </properties>
                        </deployable>
                        <deployable>
...
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>
...
</project>

Maven

$ mvn -verison
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T10:29:23-07:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"

Java

$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
yegor256 commented 9 years ago

@mfulton26 can you please post a full error log you're getting? well, the tail of it, to understand the root cause of the issue

mfulton26 commented 9 years ago

@yegor256

[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-cacheable for automated cleaning of expired @Cacheable values
[ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://aspects.jcabi.com/jsr-303.html)
[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-loggable for watching of @Loggable annotated methods
[INFO] reuse existing database false
[INFO] deleted /path/to/my/root/project/acceptance/target/mysql-data directory
[INFO] created /path/to/my/root/project/acceptance/target/mysql-data directory
[INFO] $ /path/to/my/root/project/acceptance/target/mysql-dist/scripts/mysql_install_db --defaults-file=/path/to/my/root/project/acceptance/target/mysql-data/my-default.cnf --force --innodb_use_native_aio=0 --datadir=/path/to/my/root/project/acceptance/target/mysql-data/data --basedir=/path/to/my/root/project/acceptance/target/mysql-dist
[INFO] >> FATAL ERROR: Could not find /path/to/my/root/project/acceptance/target/mysql-dist/bin/my_print_defaults
[INFO] >> 
[INFO] >> If you compiled from source, you need to run 'make install' to
[INFO] >> copy the software into the correct location ready for operation.
[INFO] >> 
[INFO] >> If you are using a binary release, you must either be at the top
[INFO] >> level of the extracted archive, or pass the --basedir option
[INFO] >> pointing to that location.
[INFO] >> 
[INFO] $ /path/to/my/root/project/acceptance/target/mysql-dist/bin/mysqld --no-defaults --user=mfulton --general_log --console --innodb_buffer_pool_size=64M --innodb_log_file_size=64M --log_warnings --innodb_use_native_aio=0 --binlog-ignore-db=root --basedir=/path/to/my/root/project/acceptance/target/mysql-dist --lc-messages-dir=/path/to/my/root/project/acceptance/target/mysql-dist/share --datadir=/path/to/my/root/project/acceptance/target/mysql-data/data --tmpdir=/path/to/my/root/project/acceptance/target/mysql-data/temp --socket=/path/to/my/root/project/acceptance/target/mysql-data/mysql.sock --pid-file=/path/to/my/root/project/acceptance/target/mysql-data/mysql.pid --port=3306
[INFO] >> 2015-01-12 12:42:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[INFO] >> 2015-01-12 12:42:53 82761 [Warning] Can't create test file /path/to/my/root/project/acceptance/target/mysql-data/data/HOSTNAME.lower-test
[INFO] >> 2015-01-12 12:42:53 82761 [Warning] Can't create test file /path/to/my/root/project/acceptance/target/mysql-data/data/HOSTNAME.lower-test
[INFO] >> /path/to/my/root/project/acceptance/target/mysql-dist/bin/mysqld: Can't change dir to '/path/to/my/root/project/acceptance/target/mysql-data/data/' (Errcode: 2 - No such file or directory)
[INFO] >> 2015-01-12 12:42:53 82761 [ERROR] Aborting
[INFO] >> 
[INFO] >> 2015-01-12 12:42:53 82761 [Note] Binlog end
[INFO] >> 2015-01-12 12:42:53 82761 [Note] /path/to/my/root/project/acceptance/target/mysql-dist/bin/mysqld: Shutdown complete
[INFO] >> 
[ERROR] #start('Config(tcpport=3306, dbuser=root, dbpassword=root, name=root, dbopts=[])', /path/to/my/root/project/acceptance/target/mysql-dist, /path/to/my/root/project/acceptance/target/mysql-data, true, NULL): thrown java.io.IOException(socket /path/to/my/root/project/acceptance/target/mysql-data/mysql.sock is not available after 5min of waiting) out of com.jcabi.mysql.maven.plugin.Instances#waitFor[322] in 5min
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:10 min
[INFO] Finished at: 2015-01-12T12:47:53-07:00
[INFO] Final Memory: 32M/362M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jcabi:jcabi-mysql-maven-plugin:0.9:start (mysql-test) on project ARTIFACT_NAME: failed to start MySQL server: socket /path/to/my/root/project/acceptance/target/mysql-data/mysql.sock is not available after 5min of waiting -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1
C-h-e-r-r-y commented 8 years ago

It seems that I got it.

What is the problem?

jcab plugin downloads packaged zip archive with mysql. Yep, it correct resolve version and os name, but an mysql from archive need some libraries which are not present in linux (it can depends on x64 or x32 OS version).

I am very sorry that I can not provide you full build log. because it was deleted, but I can share some parts from it. Consider:

[INFO] --- jcabi-mysql-maven-plugin:0.9:start (mysql-test) @ some-server ---
[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-cacheable for automated cleaning of expired @Cacheable values
[INFO] HV000001: Hibernate Validator 5.1.2.Final
[ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://aspects.jcabi.com/jsr-303.html)
[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-loggable for watching of @Loggable annotated methods
[INFO] reuse existing database false
[INFO] created /opt/jenkins/workspace/integration_tests/server/target/mysql-data directory
[INFO] $ /opt/jenkins/workspace/integration_tests/mysql-server/scripts/mysql_install_db --defaults-file=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/my-default.cnf --force --innodb_use_native_aio=0 --datadir=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/data --basedir=/opt/jenkins/workspace/integration_tests/mysql-server
[WARNING] >> /opt/jenkins/workspace/integration_tests/mysql-server/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[INFO] >> Installing MySQL system tables...
[INFO] $ /opt/jenkins/workspace/integration_tests/mysql-server/bin/mysqld --no-defaults --user=root --general_log --console --innodb_buffer_pool_size=64M --innodb_log_file_size=64M --log_warnings --innodb_use_native_aio=0 --binlog-ignore-db=some --basedir=/opt/jenkins/workspace/integration_tests/mysql-server --lc-messages-dir=/opt/jenkins/workspace/integration_tests/mysql-server/share --datadir=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/data --tmpdir=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/temp --socket=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/mysql.sock --pid-file=/opt/jenkins/workspace/integration_tests/server/target/mysql-data/mysql.pid --port=37544
[INFO] >> /opt/jenkins/workspace/integration_tests/mysql-server/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
[ERROR] #start('Config(tcpport=43461, dbuser=root, dbpassword=root, name=some, dbopts=[])', /opt/jenkins/workspace/integration_tests/mysql-server, /opt/jenkins/workspace/integration_tests/server/target/mysql-data, true, NULL): thrown java.io.IOException(Cannot run program "/opt/jenkins/workspace/integration_tests/mysql-server/bin/mysqld" (in directory "/opt/jenkins/workspace/integration_tests/mysql-server"): error=2, No such file or directory) out of java.lang.ProcessBuilder#start[1048] in 86ms

Pay attention on line [WARNING] >> - it is a source of error. The "not found" library may be different, it depends on OS and mysql version. This message was received for centOS 6.6 and mysql version 5.6.21. For same OS and 5.6.14 there were 2 libraries (can not provide name for you, because log was deleted).

How to solve?

Search for warnings and install these libraries manually (with yum install command).

Note

After installing these libraries Mysql may need some others libraries to install, pay attention on following [WARNING] >>.

About log provided in issue request

The log provided on first message seem do not contains any [WARNING] >>, the problem may be differ or some log message may be lost.

C-h-e-r-r-y commented 8 years ago

Also I have spot for MySql version 5.6.21 there is an error (as described in post above):

[WARNING] >> sh: /opt/jenkins/workspace/integration_tests/mysql-server/bin/my_print_defaults: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[WARNING] >> sh: /opt/jenkins/workspace/integration_tests/mysql-server/bin/mysqld: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

It happens both on centOS 6.6 and Ubuntu 15.10. Could you please test you plugin 0.9 with MySql 5.6.21and these operation systems?

dalvizu commented 8 years ago

Seeing this error - I believe that the incorrect binary is being packaged. classify sets my version correctly to linux-amd64:

[INFO] --- jcabi-mysql-maven-plugin:0.9:classify (mysql-classify) @ web ---
[INFO] ${mysql.classifier} set to "linux-amd64"

However I get this error trying to run:

[INFO] --- jcabi-mysql-maven-plugin:0.9:start (start-stop-mysql) @ web ---
[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-cacheable for automated cleaning of expired @Cacheable values
Jul 05, 2016 3:05:52 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 5.1.2.Final
[ERROR] JSR-303 validator failed to initialize: Unable to instantiate Configuration. (see http://aspects.jcabi.com/jsr-303.html)
[INFO] jcabi-aspects 0.18/55a5c13 started new daemon thread jcabi-loggable for watching of @Loggable annotated methods
[INFO] reuse existing database false
[INFO] created /var/lib/jenkins/tmp/mysql-data directory
[INFO] $ /var/lib/jenkins/tmp/mysql-dist/scripts/mysql_install_db --defaults-file=/var/lib/jenkins/tmp/mysql-data/my-default.cnf --force --innodb_use_native_aio=0 --datadir=/var/lib/jenkins/tmp/mysql-data/data --basedir=/var/lib/jenkins/tmp/mysql-dist
[WARNING] >> sh: 1: /var/lib/jenkins/tmp/mysql-dist/bin/my_print_defaults: not found
[WARNING] >> sh: 1: /var/lib/jenkins/tmp/mysql-dist/bin/mysqld: not found
[INFO] >> Installing MySQL system tables...
[INFO] $ /var/lib/jenkins/tmp/mysql-dist/bin/mysqld --no-defaults --user=jenkins --general_log --console --innodb_buffer_pool_size=64M --innodb_log_file_size=64M --log_warnings --innodb_use_native_aio=0 --binlog-ignore-db=pingone_test --basedir=/var/lib/jenkins/tmp/mysql-dist --lc-messages-dir=/var/lib/jenkins/tmp/mysql-dist/share --datadir=/var/lib/jenkins/tmp/mysql-data/data --tmpdir=/var/lib/jenkins/tmp/mysql-data/temp --socket=/var/lib/jenkins/tmp/mysql-data/mysql.sock --pid-file=/var/lib/jenkins/tmp/mysql-data/mysql.pid --port=56120
[ERROR] #start('Config(tcpport=56120, dbuser=pingone, dbpassword=pingone, name=pingone_test, dbopts=[])', /var/lib/jenkins/tmp/mysql-dist, /var/lib/jenkins/tmp/mysql-data, true, NULL): thrown java.io.IOException(Cannot run program "/var/lib/jenkins/tmp/mysql-dist/bin/mysqld" (in directory "/var/lib/jenkins/tmp/mysql-dist"): error=2, No such file or directory) out of java.lang.ProcessBuilder#start[1041] in 306ms

The file does exist though:

dalvizu@com-ort-den-cis-multicore8-5c5d54e5-159-233:/var/lib/jenkins/tmp$ ls -l /var/lib/jenkins/tmp/mysql-dist/bin/mysqld

It is a 32-bit file though!!

jenkins@com-ort-den-cis-multicore8-5c5d54e5-159-233:~/tmp/mysql-dist/bin$ file mysqld
mysqld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

It looks like this is what was uploaded:

$ wget https://repo1.maven.org/maven2/com/jcabi/mysql-dist/5.6.21/mysql-dist-5.6.21-linux-amd64.zip
$ unzip mysql-dist-5.6.21-linux-amd64.zip
$ file bin/mysqld
bin/mysqld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

Previous version is fine:

$ wget https://repo1.maven.org/maven2/com/jcabi/mysql-dist/5.6.14/mysql-dist-5.6.14-linux-amd64.zip
$ unzip mysql-dist-5.6.14-linux-amd64.zip
$ file bin/mysqld
bin/mysqld: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
dfa1 commented 7 years ago

got same problem, 2 years later: the mysql-dist-5.6.21-linux-amd64.zip has 32bit binaries.

dfa1 commented 7 years ago

It would be nice to also upgrade to the latest stable version of mysql 5.6.x. Needless to say I can help testing it.