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

mariaDB4j-springboot fails to start on 2.6.0 (2.5.3 works) #632

Closed
jejanim opened this issue Oct 25, 2022 · 10 comments
Closed

mariaDB4j-springboot fails to start on 2.6.0 (2.5.3 works) #632

jejanim opened this issue Oct 25, 2022 · 10 comments
Assignees
Labels
helpwanted high Windows Anything specific to Microsoft Windows OS, not affecting Linux

Comments

@jejanim
Copy link

jejanim commented Oct 25, 2022

While working on an implementation for a simulator project I noticed that the "new" version 2.6.0 of artifact mariaDB4j-springboot throws errors upon starting. Downgrading to the previous release 2.5.3 "fixes" it, so one could assume that something broke or changed there.
I think it could be related to the tmpDir change vorburger@a0d2a66, but that's just a guess _o.o_/

(separated error message to improve readability, originally there were no line breaks)

ch.vorburger.exec.ManagedProcessException: 
  Program [C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base\bin\mysql_install_db.exe, 
      --datadir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\data\3306, 
      --tmpdir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\tmp\3306
  ] (in working directory C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base) 
  failed, 
  exitValue=7, 
  last 100 lines of console:

C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base\bin\mysql_install_db.exe: 
  unknown variable 'tmpdir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\tmp\3306'

Configuration is at a bare minimum:

@Configuration
public class DatabaseConfiguration {
    public MariaDB4jSpringService mariaDb() {
            MariaDB4jSpringService mariaDb = new MariaDB4jSpringService();
            mariaDb.setDefaultPort(3306);
            return mariaDb;
    }
@vorburger vorburger added helpwanted Windows Anything specific to Microsoft Windows OS, not affecting Linux labels Nov 6, 2022
@vorburger
Copy link
Collaborator

@jejanim I suspect that this could be some Windows specific issue.

The MariaDB4JSpringConfigurationTest has test coverage for this.

That test works for me, on Linux. Does it fail when you run it on Windows:

@vorburger vorburger added the high label Nov 6, 2022
@jejanim
Copy link
Author

jejanim commented Nov 7, 2022

Yes it does and the stack trace implies it fails with the exact same error.

java.lang.AssertionError: 
Expecting:
 <Unstarted application context org.springframework.boot.test.context.assertj.AssertableApplicationContext[startupFailure=org.springframework.beans.factory.BeanCreationException]>
to have a single bean of type:
 <ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService>:
but context failed to start:
Caused by: ch.vorburger.exec.ManagedProcessException: 
  Program [C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base\bin\mysql_install_db.exe, 
    --datadir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\data\64673, 
    --tmpdir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\tmp\64673] 
  (in working directory C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base) failed, 
exitValue=7, 
last 100 lines of console:
 C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base\bin\mysql_install_db.exe: 
  unknown variable 'tmpdir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\tmp\64673'

@vorburger
Copy link
Collaborator

@jejanim would you be interested in contributing to this project with a Pull Request for a new Git Hub Action that runs its test on a windows-latest runner? (Where it will currently fail, but seen this problem reproduced there would help to validate a fix someone could contribute - and ensure future non-regression.)

@jejanim
Copy link
Author

jejanim commented Nov 7, 2022

Sure.
It will, however, take quite some time. I'm not too familiar with actions because I am a gitlab person. 😛

@vorburger
Copy link
Collaborator

@jejanim and perhaps @chrisbloe or anyone else reading along here:

Now that we can clearly see the error reported above in the buil log of PR #638, we can try to fix it... but I'm not yet immediately understanding what to make of unknown variable 'tmpdir=...' - do any of you? Would you be willing to try out something:

If you "manually" (from a cmd.exe Terminal, or whatever the "shell" is in Windows nowadays) launch:

C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\base\bin\mysql_install_db.exe --datadir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\data\64673 --tmpdir=C:\Users\USERNAME\AppData\Local\Temp\MariaDB4j\tmp\64673

does that work, or give you the same error? I don't suppose that for some reason mysql_install_db.exe doesn't have a --tmpdir argument, only on Windows? Or does that unknown variable 'tmpdir=... mean something else? Anyone interested in reading up on https://www.google.com/search?q=mysql+unknown+variable what could be causing this (only on Windows), and sharing it here?

@chrisbloe
Copy link

chrisbloe commented Nov 18, 2022

Looking at https://mariadb.com/kb/en/mysql_install_dbexe, datadir is listed as an option, but tmpdir isn't...

It also isn't an option on https://mariadb.com/kb/en/mysql_install_db... so perhaps Linux ignores unknown arguments, but Windows validates each one?

Maybe we need to check if the tmpdir is being used when run on Linux? If not, is there a way to see which tmp directory is being used?

@MazenAmria
Copy link
Contributor

so perhaps Linux ignores unknown arguments

No, linux isn't ignoring the arguments, it passes them to mysqld.
I've created issue https://github.com/vorburger/MariaDB4j/issues/646 and then saw that issue and realized they're the same, https://github.com/vorburger/MariaDB4j/issues/646 contains more details about that problem.

@tomwhoiscontrary
Copy link

Not sure if this is related, but i just tried building the project on Linux, and one test failed with a message somewhat like this.

[ERROR] ch.vorburger.mariadb4j.tests.MariaDB4jSampleTutorialTest.testLocalMariaDB  Time elapsed: 0.108 s  <<< ERROR!
ch.vorburger.exec.ManagedProcessException: An error occurred while installing the database
	at ch.vorburger.mariadb4j.DB.install(DB.java:141)
	at ch.vorburger.mariadb4j.DB.newEmbeddedDB(DB.java:89)
	at ch.vorburger.mariadb4j.tests.MariaDB4jSampleTutorialTest.check(MariaDB4jSampleTutorialTest.java:85)
	at ch.vorburger.mariadb4j.tests.MariaDB4jSampleTutorialTest.testLocalMariaDB(MariaDB4jSampleTutorialTest.java:63)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:377)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:284)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:248)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
Caused by: ch.vorburger.exec.ManagedProcessException: Program [/usr/bin/mysql_install_db, --datadir=/tmp/MariaDB4j/data/38085, --tmpdir=/tmp/MariaDB4j/tmp/38085, --basedir=/usr, --no-defaults, --force, --skip-name-resolve] (in working directory /usr) failed, exitValue=1, last 100 lines of console:
mysql_install_db: [ERROR] unknown variable 'tmpdir=/tmp/MariaDB4j/tmp/38085'
2023-03-17 20:54:23 [ERROR]   Unrecognized options
	at ch.vorburger.exec.ManagedProcess.checkResult(ManagedProcess.java:310)
	at ch.vorburger.exec.ManagedProcess.startExecute(ManagedProcess.java:216)
	at ch.vorburger.exec.ManagedProcess.start(ManagedProcess.java:155)
	at ch.vorburger.mariadb4j.DB.install(DB.java:138)
	... 31 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.access$200(DefaultExecutor.java:48)
	at org.apache.commons.exec.DefaultExecutor$1.run(DefaultExecutor.java:200)
	at java.base/java.lang.Thread.run(Thread.java:833)

This is on commit 56dd321, on Ubuntu 18.04.6.

@tomwhoiscontrary
Copy link

Same version builds cleanly for me on Fedora Linux 36, after installing MariaDB. On that machine i have MariaDB 10.5.18-MariaDB. Maybe the version on Ubuntu is just too old?

@vorburger
Copy link
Collaborator

With the merge of #638, Windows is now tested on CI and the problems shown above should be resolved.

I am therefore closing this old issue (which mixed a number of problems anyway) at this stage.

Please open new issues for any new problems - if they are still occuring with the 3.0.1 or later release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
helpwanted high Windows Anything specific to Microsoft Windows OS, not affecting Linux
Projects
None yet
Development

No branches or pull requests

5 participants