I have two javafx apps an App and Updater. App uses Firebird database to store some fragile user data. Database runs in embedded mode (I think it's relevant), so that means that there can be only one connection to the database at the same time (database creates a lock file). Updater updates App.
The whole schema looks like this:
- User runs App-> App is checking if an update is required if it is then it starts Updater (Using java ProcessBuilder) and closes itself (Platform.exit()).
- Updater checks if App has been terminated properly.
- Updater runs command "App --export-user-data" (also using ProcessBuilder) to export the most important things before starting an update (has to be done this way - I cannot move this function to Updater).
- App freezes on first session.beginTransaction() - there is no single error or exception
What I have observed till now:
- When I start App and close it by pressing [X] then all lock files from "C:\ProgramData\firebird" are removed, but when App starts Updater and closes itself then the lock files stay untouched. I think that's why Hibernate cannot begin transaction.
- Updater's process is not subprocess of App (I checked this using process monitor)
- When I directly start Updater it works like a charm - so the problem shows up only when App starts Updater.
Things I can't do:
- switch database to anything else - it has to be firebird embedded
- move export function to Updater
I would be greatful for even weirdest ideas because I spent four days trying to solve this problem.
edit: Firebird version: 2.1 Jaybird version: 2.1.6
The way Updater is started (only necessary things)
public void startUpdater(){
ProcessBuilder pb = new ProcessBuilder(updaterPath, argument)
pb.start();
Platform.exit();
}