(Note: The prior conversation about this issue was incorrectly marked answered)
After months of searching and testing, I’ve narrowed an issue down to ServerSockets using SSLSocket. Prior releases of our Xojo networking code an fine for years. Early this year, we updated the app to use SSLSockets and a new version of Xojo. Since, we’ve had a number of Mac users suddenly unable to connect clients with their app daemon running on their network.
Here’s what I did to narrow it down to an SSLSocket issue:
-
I duplicated our SSLSocket and changed the Super of the duplicate to TCPSocket.
-
On the new TCPSocket, I commented out the SSLSocket specific .Secure and .ConnectionType property settings.
-
I created a program preference for using SSL or TCP connections on both client and server.
-
This test build has now run several weeks at a handful of customer sites experiencing this problem.
-
When the daemon ServerSocket is using TCPSocket connections, the daemon runs normally for extended periods of time.
-
When the daemon ServerSocket is switched to use SSLSockets, after several days of running idle (like over a weekend), new client connections fail. New client TCPSocket.Connect is successful, followed immediately by receiving an 102 disconnect from the daemon.
Observations:
(i) This connect/disconnect with a 102 behavior in 6 is the same as when a ServerSocket reaches MaxConnections. So I’ve logged MaxConnections and the ServerSocket reports that this is not the issue.
(ii) When in this state, it is only new connections that fail. Existing clients with already established connections continue to communicate and operate with the daemon perfectly. It appears that each customer site with this issue is leaving clients connected all the time (this may or may not be related).
(iii) When in this state, closing an existing connected client and attempting to reconnect results in the same inability to reconnect.
(iv) Quitting and restarting a client does not change the issue.
(v) Reinitializing the ServerSocket within the daemon does not change the issue.
(vi) Restarting the daemon immediately resolves the issue until the daemon runs idle again for several days.
(vii) This issue appears to be Mac OS only, We’ve seen it on OS X 10.6, 10.8, 10.10 and 10.11. It has not been reported by any of our many Windows customers running the same app as a service.
(viii) When in this state, the ServerSocket reports normal function and listening. NetStat confirms the socket/port is listening.
(ix) Xojo objectcount, memory usage, CPU usage, and all other observable properties indicate that the daemon is functioning normally.