PostgreSQL (pg_hba.conf / postgresql.conf) The connection to the server was lost. Attempting reset: Failed


I have a problem with Postgres that others seem to have found but the solutions that are given somehow do not work for me. I explain:


  • MacOS 10.15.6
  • Installed through Homebrew
  • PostgreSQL 12.2 on x86_64-apple-darwin, compiled by Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn), 64-bit


I have been doing queries without problems but some of them crash my system, here is one of the examples

FROM weather w1
JOIN weather w2
    ON EXTRACT(DAY FROM CAST(w2.recorddate AS TIMESTAMP)-CAST(w1.recorddate AS TIMESTAMP)) = 1
        AND w2.temperature > w1.temperature;


server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

I tried on PgAdmin and it also crashes.


The pg_hba.conf file

  • I tried some of the suggestions in this thread without success

The postgresql.conf file

  • I tried adding listen_addresses = '*' to the end of the file without success


I went back to the defaults I had originally but now I am not sure if everything is in order

My pg_hba.conf file looks like this:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all               trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all               trust
host    replication     all             ::1/128                 trust

My postgresql.conf has the following settings

  • listen_addresses = 'localhost'
  • port = 5432


Any suggestion on where to look, what to reinstall, or what to do? It is a bit uncomfortable not being able to run certain queries.



Process:               postgres [11542]
Path:                  /Users/USER/*/postgres
Identifier:            postgres
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        postgres [123]
Responsible:           postgres [123]
User ID:               502

Date/Time:             2020-09-06 14:06:05.972 -0700
OS Version:            Mac OS X 10.15.6 (19G2021)
Report Version:        12
Anonymous UUID:        C82E0E26-CE4B-F615-A561-84E475FEB121

Sleep/Wake UUID:       4B9FB152-7EE9-4D77-B3B3-909D1AD8479A

Time Awake Since Boot: 7500 seconds
Time Since Wake:       740 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue:

Exception Type:        EXC_BAD_ACCESS (Code Signature Invalid)
Exception Codes:       0x0000000000000032, 0x000000010453f000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace CODESIGNING, Code 0x2

kernel messages:

VM Regions Near 0x10453f000:
    __LINKEDIT             0000000104466000-000000010453f000 [  868K] r--/rw- SM=COW  /Users/USER/*/*.dylib
--> VM_ALLOCATE            000000010453f000-0000000104543000 [   16K] r-x/rwx SM=COW  
    __TEXT                 0000000104544000-0000000104562000 [  120K] r-x/rwx SM=COW  /Users/USER/*/*.dylib

Application Specific Information:
crashed on child side of fork pre-exec

Thread 0 Crashed:: Dispatch queue:
0   ???                             0x000000010453f000 0 + 4367577088
1   postmaster                      0x00000001035841c6 ExecScan + 582 (execScan.c:239)
2   postmaster                      0x00000001035a5270 ExecSort + 240 (nodeSort.c:109)
3   postmaster                      0x000000010359e581 ExecMergeJoin + 241 (nodeMergejoin.c:657)
4   postmaster                      0x000000010359e581 ExecMergeJoin + 241 (nodeMergejoin.c:657)
5   postmaster                      0x00000001035a5270 ExecSort + 240 (nodeSort.c:109)
6   postmaster                      0x00000001035a654d ExecGroup + 109 (nodeGroup.c:70)
7   postmaster                      0x000000010357c3bf standard_ExecutorRun + 287 (execMain.c:364)
8   postmaster                      0x00000001036e1963 PortalRunSelect + 243 (pquery.c:931)
9   postmaster                      0x00000001036e153e PortalRun + 430 (pquery.c:770)
10  postmaster                      0x00000001036e0585 exec_simple_query + 1445 (postgres.c:1223)
11  postmaster                      0x00000001036de40d PostgresMain + 3917 (postgres.c:4249)
12  postmaster                      0x000000010365ee28 PostmasterMain + 7832 (postmaster.c:1377)
13  postmaster                      0x00000001035cbbce main + 1678
14  libdyld.dylib                   0x00007fff6b701cc9 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x000000010453f000  rbx: 0x00007fc79682d4c0  rcx: 0x0000000106f818d8  rdx: 0x00007ffeec82e5e7
  rdi: 0x00007fc79682d578  rsi: 0x00007fc79682d1a0  rbp: 0x00007ffeec82e610  rsp: 0x00007ffeec82e5b8
   r8: 0x0000000000016d3d   r9: 0xffffffff00000000  r10: 0x0000000106f818d0  r11: 0x00007fc799288730
  r12: 0x00007fc79682d578  r13: 0x00007fc79682be00  r14: 0x00007fc79682d1a0  r15: 0x0000000103a3c240
  rip: 0x000000010453f000  rfl: 0x0000000000010246  cr2: 0x000000010453f000
Logical CPU:     0
Error Code:      0x00000015 (invalid protections for user instruction read)
Trap Number:     14
asked on Stack Overflow Sep 6, 2020 by JourneyDS • edited Sep 6, 2020 by JourneyDS

1 Answer


This looks like a known issue where JIT code is not signed properly and triggers security errors on MacOS. I thought a fix for this was already released, so I don't know why you would still be seeing it on 12.4, but in any event turning jit=off should fix the problem.

answered on Stack Overflow Sep 7, 2020 by jjanes

User contributions licensed under CC BY-SA 3.0