Sequoia URLConnection errors for first few requests

I’m having trouble tracking down an issue that has appeared in Sequoia debug runs. Built apps don’t appear to have this issue. When my app starts, it makes two requests that both immediately error with -1009, which means there is no internet connection. This is of course not true, and curiously, the problem seems to quickly resolve itself. It’s like there is a delay at launch where URLConnection isn’t working. The URL I’m connecting to is a subdomain I have overridden in my hosts file so it connects to a server in my home instead. It has a self-signed certificate that the system trusts. The app is signed and sandboxed, even in debug runs.

I suspect this has something to do with the local network permissions, but I don’t get asked to allow the app, and it’s also listed as allowed in the local network section of privacy settings.

I’m kind of at a loss with this one. Any ideas?

I do a similar thing, but with Pi-hole on my network instead of the hosts file. Just throwing the idea out there, maybe try using DNS to do your network instead of hosts and see if that tricks Sequoia into behaving?

It makes no difference. I believe mDNSResponder looks up the ip address, and local area permission is triggered based on the result. Curiously, I tried adding a delay to my launch process, and that fixed one of the requests, but not the other.

There’s definitely a time factor to this. I added a dummy request to my launch queue to “prime” the OS. If it hits an exception, it waits a second before moving to the next task. I tried only performing the request, and only waiting (up to 7 seconds before I gave up) but neither alone helped. I bet the second wait could be shorter, but I can live with a second. And of course, this code only triggers on debug runs.

I think there’s a delay with network connections being available for use in Sequoia. With my app it’s a TCP connection that is to connect as soon as the app starts. The initial connection seems to error out when debugging. Haven’t seen it in the built app yet. Subsequent connection requests are fine.

I’m wondering if we are both seeing the same problem but with two different networking protocols.

Sounds likely

@Thom_McGrath - have you tried 15.1? I ran into a similar problem testing Profile Tester and updating to the latest beta seems to have fixed it.

I have not. I don’t run beta operating systems on my production machine, and installing betas in a VM is… painful. Though that should be easier now that the host OS supports such a thing.

image

released earlier today.

I can confirm a delay, but no explanation.

It may has to do with this?
https://twitter.com/patrickwardle/status/1836860191888810373

15.0.1 does seem to fix it. I’ve removed my workaround and I have not seen problems.

3 Likes

Also, regarding this:

I’ve seen weird behavior when I first run a built app immediately after building.

My theory is that when the OS sees a new app, it starts doing some sort of security scan, and if you launch the app too soon, you may get weird behavior. But if you wait “a while” and then launch the app, it works fine.

I wonder if you would also see these issues if you launched your built app immediately after building?

Perhaps this is all moot of 15.0.1 fixes it…

Not fixed here.

My app opens a mysql connection on startup. A built app will work most of the time. In the debugger, forget it. Tried sleeping, adding multiple connects, dns name, ip address, nothing helps. The only change from when it worked perfectly was installing Sequoia.

Reinstalling Sonoma until Apple/Xojo fixes this bug.

Do you happen to have the OS build version number for 15.0.1?

The build number is 24A348

2 Likes

Well… still on 15.0.1 of course, but the issue is back.

I wonder if this means that the app is now in an “internet quarantine” in the first few seconds.

Edit: I found several articles just now that suggest turning off the macOS firewall may be a quick fix until Apple straightens this out.

1 Like

I’ve done some more work on this as I have been having issues with TCPConnections.

I created a test app and found that it can take up to 15 seconds or more after an app is launched before you can make a successful TCP connection. When the connection fails you get error code 65 returned which is “No route to host.” I would expect this is the same issue that URLConnections are seeing as well.

I am still on 15.0 so I will try updating also. Maybe that will help.

  1. Update your Sequoia
  2. System Settings → Privacy & Security → Local Network → [Find affected App] → Toggle ON
  3. Restart the computer

There is definitely something wrong with networking in Sequoia, even in 15.0.1. I have another thread about a console app that just sort of hangs in limbo randomly. I can’t even complete a large file transfer to my NAS without it getting stuck and eventually timing out.

Greg’s suggestion to turn off the firewall seems to have helped. I haven’t tested the two Xojo issues yet, but I was able to get my file transfer completed.

1 Like