smashedtoatoms / asdf-postgres

asdf plugin for Postgres
MIT License
201 stars 37 forks source link

Postgres compiled using asdf on Macos Sonoma OOMs when connecting to Heroku Postgres (and probably all RDS) #84

Open pelletencate opened 8 months ago

pelletencate commented 8 months ago

Describe the bug

I don't exactly know what causes this, but whenever I try to connect to remote Heroku Postgres database with PostgreSQL built using asdf on macos Sonoma, it crashes with an "Out of Memory" error. (And if I use ruby's pg gem, it makes Ruby segfault, but that's probably out of scope). I have tried it with various versions of Postgres: 14.6, 14.10 and the very latest 16. I don't know if this is related to the recent update to OpenSSL.

The reason why I report this, however, is that I noticed that Homebrew's PostgreSQL - very same versions - do not have this problem. I looked at the small patch they apply to libpq (which you can find in both the PostgreSQL as the libpq formulas) and had asdf-postgres apply it to its source before building it. After having done this, the problem disappeared.

I'm quite invested in this issue and I would have made a PR, but I noticed the patches on Homebrew aren't identical between versions. Well, as far as I can tell based on my limited investigation, the patched lines are identical across versions but the line numbers differ. I'm not sure how to proceed, my knowledge of writing and applying patches is a bit too limited.

Steps to reproduce

Expected behavior

Connection and execution without trobule

Observed behavior

psql: out of memory

austinworks commented 7 months ago

I am also seeing this issue when attempting to connect to a remote pg instance. might be related to new openssl

smashedtoatoms commented 7 months ago

https://github.com/smashedtoatoms/asdf-postgres/issues/80#issuecomment-1954665952 may fix this now. Although the fact that you are getting it on 14 makes me think possibly not. Can you try 16.2 and see if it works for you? I don't have time to chase down postgres patches and figure out how to apply them, especially if they're fixed in 16.2, so hopefully 16.2 behaves. If it doesn't, can you include the entire error message?