28

I am trying to run pg_dump (or even psql) over our postgresql server v13, with binaries from v13 and v16. Both don't work for me, but do work for my colleagues that are not on Mac, not sure if it's related to that.

When I try to run:

pg_dump -U grails --verbose --host=<host> --port=<port> --format=plain <db_name> > <target_file>

or even simple:

psql -U grails --host=.. --port=..

I get the following:

pg_dump: error: connection to server at "...", port ... failed: FATAL:  no PostgreSQL user name specified in startup packet
connection to server at "...", port ... failed: FATAL:  no PostgreSQL user name specified in startup packet
pg_dump(71055,0x1db08dec0) malloc: *** error for object 0x92: pointer being freed was not allocated
pg_dump(71055,0x1db08dec0) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    71055 abort      pg_dump --verbose --host=... --port=... -U grails --format=plain  

The user name is clearly specified as parameter and my colleagues have no problem. The malloc errors are weird too. What might be happening?

4
  • That looks to me like some kind of corruption of the executable file or a library it uses. What if you try to connect with psql (rather than pg_dump) using the same connection parameters? Can you reproduce the problem on other Macs? What if you change the username to something else? I would expect it to fail, but does it fail with the same error or a different one?
    – jjanes
    Commented Nov 27, 2023 at 13:49
  • psql failed as well with the same error. Interesting. It does not fail though when connecting to my local db. Even just psql with host and port (and username) throws it when connecting to that server. If I am running on M1Pro and the server is running on a different architecture, that shouldn't be an issue, right?
    – Ev0oD
    Commented Nov 27, 2023 at 13:58
  • I might try another mac a bit later to check
    – Ev0oD
    Commented Nov 27, 2023 at 14:18
  • 1
    I just upgraded to Sonoma 14.1.1 and started having the same problem, my postgres is v15. Re-installing postgres with brew seems to have no effect, brew doctor doesn't think there is an issue. Colleagues who haven't upgraded yet don't seem to have this problem.
    – Shagglez
    Commented Nov 27, 2023 at 14:21

2 Answers 2

50

This issue (which I also faced) seems to be caused by an incompatibility/bug between Postgres and openssl version 3.2.0.

Homebrew's Postgreses now are compatible with openssl 3.2, please run brew upgrade postgresql@<YOUR POSTGRES VERSION> or brew upgrade libpq to get the fixed version here for homebrew users

(before Nov 28, 2023: Downgrading to openssl version 3.1.4 (as documented here for homebrew users) worked for me as a workaround.)

2
3

Seems like the problem is with the brew version of Postgres. I tried installing Postgres with their installer from the official website and I am not running into the issues that I have when using binaries I fetched from homebrew.

2
  • It's probably some linked lib rather than postgres itself, but that's a useful workaround for the time being +1
    – Shagglez
    Commented Nov 27, 2023 at 14:52
  • I also fixed it by brew installing a newer version of postgres brew install postgres@14 even though the remote database is pg 13.10. The failing version from brew was 13.13
    – Gangstead
    Commented Jan 9 at 15:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.