MariaDB4j: Asked to waitFor but it was never even start()'ed - since 2.4.0

First, thanks for the nice project, it’s of great help!

I’m using it for writing JUnit test. Lately i was upgrading from 2.3.0 to 2.4.0 and got those sporadic failures:

Caused by: ch.vorburger.exec.ManagedProcessException: An error occurred while running a command: create database if not exists `db1`;
at ch.vorburger.mariadb4j.DB.run(DB.java:300)
at ch.vorburger.mariadb4j.DB.run(DB.java:265)
at ch.vorburger.mariadb4j.DB.run(DB.java:269)
at ch.vorburger.mariadb4j.DB.createDB(DB.java:308)
at europa.testsupport.MySqlEnv.createDatabase(MySqlEnv.java:74)
... 78 more
Caused by: ch.vorburger.exec.ManagedProcessException: Asked to waitFor Program [/tmp/europa.domain.space.ListJdbcTablesHandlerTest5747555168995803376/mysql-base/bin/mysql, --socket=/tmp/MariaDB4j.35895.sock] (in working directory /tmp/europa.domain.space.ListJdbcTablesHandlerTest5747555168995803376/mysql-base), but it was never even start()'ed!
at ch.vorburger.exec.ManagedProcess.assertWaitForIsValid(ManagedProcess.java:478)
at ch.vorburger.exec.ManagedProcess.waitForExitMaxMsWithoutLog(ManagedProcess.java:439)
at ch.vorburger.exec.ManagedProcess.waitForExit(ManagedProcess.java:418)
at ch.vorburger.mariadb4j.DB.run(DB.java:298)

Those happended on the build server which is on linux. On my local Mac i hadn’t had those problems. Downgrading to 2.3.0 stabilized everything!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 31 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Instead of this (which does invoke a new process):

DB databaseServer = ...;
databaseServer.createDB(name);

I use this:

DB databaseServer = ...;
MariaDbDataSource dataSource = new MariaDbDataSource();
dataSource.setUser("SA");
dataSource.setPassword("");
dataSource.setPort(databaseServer.getConfiguration().getPort());

try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()){
    statement.execute("create database if not exists `" + name + "`;");
}

And it seems like this trick solves the issue.