I wonder if this is vulnerable to a race condition? What happens if I open a connection on the socket after it's created, but before chmod is called? Will my query still be processed? I'm not sure how to verify this.