If I see an entry in pg_stat_activity for a client_addr:client_port combination where there is no process bound to that port on the indicated client, what does that mean? Just that the client process exited before the query completed?
You are probably correct that this simply means that the client process exited. If it exits without cleaning up the connection while its back-end server process is working on a query, then the server process will not notice until it tries to send a message to the client and finds that no one is there.
If it takes a long time to return a tuple (because it has to sort or aggregate before it sends the first one, for example) then the server process can be a dead man walking for a long time.
There was discussion about fixing this, but finding a way to do it in a performant and cross-platform way is not easy.
It's hard to say given the lack of specifics here, but most likely it's just timing differences - the backend exited moments after you looked at
pg_stat_activity and before you looked at
netstat or whatever you were using to look at it at the OS level.
pg_stat_activity gets cleaned up when the postmaster notices the child process exiting, so if the postmaster is extremely busy it might take a moment after the backend actually exits. However, you'd usually see a short-lived "zombie" process still there until the postmaster notices it. It may or may not retain its socket.