I’d like to clarify your setup. Specifically, I’d like to get a better understanding of the actors involved. You mentioned:
- Your “client server application”
- “a file server on the same machine”
- Copying “using using Finder or terminal using
cp
”
So, is your client/server app one app? Or two? And is the server running locally as well? Or just the client?
Is the client/server app related to the file server? Or are you using some standard file server protocol, like SMB? And if it’s a standard file server protocol, are you using the built-in client and server implementations? Or something custom?
Also, what version of macOS is this?
And do you see any crash reports generated at the time you see this error?
Oh, and some random notes…
I’m not sure where you got EBROKENPIPE
from. The error I’d expect to see when you write to a disconnected socket [1] is EPIPE
(32).
necp_socket_find_policy_match: Marking socket in state 258 as defunct
NECP is the subsystem on Apple platforms that manages access to the network. I talk about it in general terms in A Peek Behind the NECP Curtain. I originally suspected that this log message wasn’t a cause, but a symptom. That is, the connection had failed, NECP had noticed that failure, and it’s logging that state change. However, after looking at this specific log message, I’m not so sure.
A defunct socket is one where the underlying resource have been reclaimed. You typically see this on iOS — in TN2277 Networking and Multitasking I explain that cause — but it is possible to get defunct sockets on macOS.
The 258 in that message is the value of the so_state
property within the kernel. If you’re curious, you can follow this thread in the Darwin open source. My reading is that it has the SS_NBIO
(non-blocking I/O) and SS_ISCONNECTED
(connected) flags set. So the socket was connected when NECP defuncted it.
Finally, this scenario reminds me of the issue discussed in Updating Mac Software:
- It happens seemingly at random.
- It’s tied to signed code.
However, this is definitely not the standard symptom for such a failure.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] Assuming that you’ve disable SIGPIPE
, which you typically do via SO_NOSIGPIPE
.