MariaDB4j icon indicating copy to clipboard operation
MariaDB4j copied to clipboard

Running DB with dump in Spring using Managedprocess

Open TheUnlimited64 opened this issue 2 years ago • 1 comments

I am currently utilizing your library to perform a specific task: fixing a .sql file and subsequently creating a dump of the fixed file. I am initiating my application via CommandLineRunner and starting the database with the .start() method, followed by running my code.

However, I am encountering an issue when attempting to wait for mysqldump to complete. Here is the code snippet I am using:

ManagedProcess managedProcess = db.dumpSQL(file, "smdb", "root", "1234").start();
        managedProcess.waitForExit();

When I attempt to call .waitForExit(), the execution seems to halt indefinitely. It appears as though the program is freezing, and no further execution occurs.

My hypothesis is that the .waitForExit() method might be blocking the main thread where the database is running, potentially leading to a deadlock situation. This is based on the observation that the main thread seems to be unresponsive during the waitForExit() call.

Unfortunately, it seems that I have limited control over the ManagedProcess instance, which makes it challenging to troubleshoot or circumvent this issue.

I am seeking your assistance to understand this behavior better and, if possible, find a solution. Could you please provide guidance on how to safely start the database, create a dump, and wait for the dump process to finish without causing a deadlock or freezing the main thread?

TheUnlimited64 avatar Feb 05 '24 21:02 TheUnlimited64

Which version of MariaDB4j are you using?

It's difficult to tell what exactly is going on based only on the description above. Would you be willing to post a full log?

If you use MariaDB4j professionally, please consider to, either:

to support future maintenance!

vorburger avatar Mar 27 '24 18:03 vorburger

It's difficult to tell what exactly is going on based only on the description above. Would you be willing to post a full log?

I'm closing this issue, because the log provided above does not permit to identify the root cause of the problem posted here.

vorburger avatar Jun 06 '24 15:06 vorburger