Open acommuni opened 6 years ago
I'm also seeing this problem on Windows. My guess is due to the execution of the postgres.exe via the 'runas' command. I considered hacking a solution by inheriting from PostgressPorcess and from EmbeddedPostgres and overwriting getProcessId() and perhaps some more methods. But this seems too fragile to me. I'll probably do an even worse hack of implementing a shutdown hook myself that would read postmaster.pid file and kill the process.
That is what I will do in my tests until this is fixed.
When stopping the embedded postgtresql is does not stop Postgresql.
It is due of the processid which is not the good one at stop.
During startup the method onAfterProcessStart is called and set the pid with the method setProcessId. It reads postmaster.pid file in order to get postgresql pid and set processId attribute.
During the stop the method getProcessId is called.
It returns process id which is pgctl id and not the postmaster id.
The method isProcessRunning is returning false because pg_ctl is stopped as far as it launched postgresql process
The method stopInternal skip the stop phase and only delete files.
I do not understand why isProcessRunning uses getProcessId() and not processId like other method