crystal icon indicating copy to clipboard operation
crystal copied to clipboard

What makes Postgraphile middleware's `release` method experimental?

Open dfellis opened this issue 3 years ago • 2 comments

Summary

I was looking for a way to spin down a postgraphile instance without spinning down the entire server, and I found the release method declared in the interfaces.ts file, but it's labeled "experimental": https://github.com/graphile/postgraphile/blob/v4/src/interfaces.ts#L382-L383

I am hesitant to use it if it leaves Postgres connections open or is incompatible with configuration options that I need.

Additional context

I asked in Discord about this, and was asked to turn this into an issue because it'll likely take some time to figure out what the restrictions are.

dfellis avatar Apr 18 '22 13:04 dfellis

I found this: https://github.com/graphile/postgraphile/pull/1396

Claims to work with watchPg which makes it perfect for my use case. Going to give it a shot and see.

dfellis avatar Apr 19 '22 13:04 dfellis

I think it's safe to use, in general we use "experimental" for two reasons:

  1. it allows us to change the API in a minor revision if we find that it does not suit our needs (thus is you're using experimental features you should pay careful attention to the release notes to see if they have been changed)
  2. if we're not 100% sure that it works in all cases.

Both of these apply to this feature, though regarding (1) I can't see us changing the API for this feature (it seems to have served its purpose well and I've not had anyone comlain about it - and I'm not sure it'll need options). (2) is the more interesting one - because this feature was added "late in the day," it's likely that there are plugins out there that don't respect it but should. So if you have any plugins that provision external resources that need to be released and they aren't added to shutdownActions, this may result in a leak. It also might have interaction issues with some first party plugins that haven't been updated - e.g. I don't know if it works well with subscriptions and/or live queries.

Try it out, stress the system. Issue a bunch of varied queries/mutations/subscriptions, release the schema, do it again over and over and monitor your open connections via PostgreSQL. They shouldn't climb.

benjie avatar Apr 20 '22 11:04 benjie

[semi-automated message] Hi, there has been no activity in this issue for a while so I'm closing it to keep the issues/pull requests manageable. If this is still an issue, please re-open with additional details.

benjie avatar Jan 03 '23 15:01 benjie