Skip to content

fix: add pg8000 graceful shutdown on Cloud Run scale-down#2330

Merged
bolyachevets merged 5 commits into
bcgov:mainfrom
panish16:fix/pg8000-graceful-shutdown
Jun 10, 2026
Merged

fix: add pg8000 graceful shutdown on Cloud Run scale-down#2330
bolyachevets merged 5 commits into
bcgov:mainfrom
panish16:fix/pg8000-graceful-shutdown

Conversation

@panish16

@panish16 panish16 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds cloud-sql-connector from sbc-connect-common as a dependency in ppr-api and mhr-api
  • Calls setup_pg8000_close_event_listener(engine) on app startup to suppress pg8000.exceptions.InterfaceError: network error logged when Cloud Run terminates idle instances and SQLAlchemy's connection pool teardown tries to close already-severed sockets

Services fixed

  • ppr-api/src/ppr_api/__init__.py
  • mhr-api/src/mhr_api/__init__.py

Background

GCP logs confirmed pg8000.exceptions.InterfaceError: network error occurring in both ppr-api-prod and mhr-api-prod on Cloud Run scale-down. This is the same fix applied across bcgov/lear (PR #4470), bcgov/bcros-common (PR #270), bcgov/sbc-auth (PR #3790), and bcgov/STRR (PR #1669).

Test plan

  • Confirm no new pg8000.exceptions.InterfaceError entries in GCP Log Explorer for eogruh-prod after deployment
  • Existing unit and integration test suites pass

@bolyachevets bolyachevets merged commit 5a3cb90 into bcgov:main Jun 10, 2026
8 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants