vibhorkum / pg_background

pg_background
GNU General Public License v3.0
136 stars 35 forks source link

Incorrectly handled BGWH_STOPPED from WaitForBackgroundWorkerStartup #15

Closed svorcmar closed 5 years ago

svorcmar commented 5 years ago

BGWH_STOPPED does not mean that the background process could not have been started, but it means it already exited - see the relevant documentation part: https://www.postgresql.org/docs/current/bgworker.html, there is no indication that error should be raised for such a return value:

... and BGWH_STOPPED indicates that it has been started but is no longer running

In our environment, pg_background_launch unpredictably and very rarely failed when BGWH_STOPPED branch was matched ("could not start background process" was reported in the log and it is the only place in the code with this message), but the process results were present and OK.