authzed / spicedb

Open Source, Google Zanzibar-inspired database for scalably storing and querying fine-grained authorization data
https://authzed.com/docs
Apache License 2.0
5.11k stars 279 forks source link

PostrgreSQL datastores do not timeout on initialization #741

Closed vroldanbet closed 1 year ago

vroldanbet commented 2 years ago

If PostgreSQL datastores are initialized on an unreachable/unresponsive database backend, the initialization hangs indefinitely, and the spicedb process wont report becoming healthy.

We can see this is caused by a missing deadline:

https://github.com/authzed/spicedb/blob/26d13e56948492537e02501c8d018e0def5ad204/internal/datastore/crdb/crdb.go#L92-L95

vroldanbet commented 1 year ago

This should be addressed for CRDB as of https://github.com/authzed/spicedb/pull/1042

josephschorr commented 1 year ago

@vroldanbet is this complete as of https://github.com/authzed/spicedb/blob/main/internal/datastore/postgres/postgres.go#L160?

vroldanbet commented 1 year ago

@josephschorr yup!