You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The answer is: pg_background_launch() will throw INSUFFICIENT_RESOURCES.
If pg_background is used for logging, this is a particularly unpleasant failure mode because:
Whatever message one tried to insert into the log table will be lost, and
The job that was being logged in this way will probably break, and
The above will happen once in a while, in an unpredictable way
One might play with the settings for max_worker_processes and max_parallel_workers, but this will not eliminate the problem, it will just make it less likely to happen.
Of course, if workers are not available, pg_background itself can't do much about it. Trouble is, the caller can't do much either. The best I've come up with is to catch the exception, do pg_sleep() for some interval, then retry. Is there a better way to handle it?
I think the documentation should at least mention this issue. If the above analysis is correct, I feel this is a significant limitation of autonomous transactions when implemented through pg_background.
The text was updated successfully, but these errors were encountered:
The answer is:
pg_background_launch()
will throwINSUFFICIENT_RESOURCES
.If pg_background is used for logging, this is a particularly unpleasant failure mode because:
One might play with the settings for
max_worker_processes
andmax_parallel_workers
, but this will not eliminate the problem, it will just make it less likely to happen.Of course, if workers are not available, pg_background itself can't do much about it. Trouble is, the caller can't do much either. The best I've come up with is to catch the exception, do
pg_sleep()
for some interval, then retry. Is there a better way to handle it?I think the documentation should at least mention this issue. If the above analysis is correct, I feel this is a significant limitation of autonomous transactions when implemented through pg_background.
The text was updated successfully, but these errors were encountered: