Re: Connecting to postgres on OSX from Swift using PostgresClientKit

From: howardnews(at)selestial(dot)com
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Connecting to postgres on OSX from Swift using PostgresClientKit
Date: 2022-08-01 11:11:10
Message-ID: 765a8435ee41406bcc445ab4e17137cf@selestial.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2022-08-01 04:06, Adrian Klaver wrote:
>> 2022-08-01T00:20:18.530Z Connection-1 finer] Created socket
>> [2022-08-01T00:20:18.532Z Connection-1 fine] Opening connection to
>> port 5432 on host localhost
>> 2022-08-01 01:20:18.534308+0100 TestPostgres[10654:120173]
>> dnssd_clientstub ConnectToServer: connect() failed
>
> A search on above error message found:
>
> https://github.com/firebase/firebase-ios-sdk/issues/3033
>
> https://developer.apple.com/forums/thread/67792
>
> https://github.com/emqx/CocoaMQTT/issues/202
>
> all of which point to what Tom Lane mentioned, sandboxing.
>
>> path:/var/run/mDNSResponder Socket:13 Err:-1 Errno:1 Operation not
>> permitted
>> 2022-08-01 01:20:18.535617+0100 TestPostgres[10654:120173]
>> [si_destination_compare] socket(PF_SYSTEM, SOCK_DGRAM,
>> SYSPROTO_CONTROL) failed: Operation not permitted
>> 2022-08-01 01:20:18.535694+0100 TestPostgres[10654:120173]
>> [si_destination_compare] socket(PF_SYSTEM, SOCK_DGRAM,
>> SYSPROTO_CONTROL) failed: Operation not permitted
>> [2022-08-01T00:20:18.537Z Connection-1 severe] Unable to connect
>> socket: Error code: -9989(0x-2705), Operation not permitted
>> [2022-08-01T00:20:18.537Z Connection-1 finer] Closing socket

Hi Adrian,

you & Tom were correct - it was sandbox settings (which was turned
off??) in Xcode which caused the problems. In case anyone else has the
problem, the steps I took to fix the problem in XCode 13.3 were as
follows:

1. Go to the project explorer and select the project.
2. Select the Target under the list of Targets
3. Select the "Signing & Capabilities" Tab/Heading
4. Under the "App Sandbox" settings, select the "Outgoing connections
(client)" checkbox.
5. Note - the "Enable App Sandbox" under Build Settings seems to have no
effect!

Apologies for not finding this myself - This was purely a MacOS / XCode
problem - but many thanks to you all (Adrian, Tom, Rob) for proving yet
again that Postgresql support is the best.

Howard.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rory Campbell-Lange 2022-08-01 13:10:00 "set autocommit on" in golang client query
Previous Message Frank Streitzig 2022-08-01 09:30:41 Re: a database can be created but not droped