Friday, June 04, 2004

Bad File Descriptor for STDIN/STDOUT/STDERR

At the risk of this becoming a blog about why problems with Windows 2003 64-bit makes my job suck, we have new excitement today.

On our brand-spanking new Windows 2003 64-bit servers, after they have been running for a while child processes of services stop inheriting the standard input/output/error streams. And not necessarily all of the streams are invalid, sometimes it is just one, sometimes two, sometimes all three. When the file descriptors become 'bad', they start showing up as file descriptor #-1. Which obviously is invalid, trying to do anything with it just results in a Bad File Descriptor error.

The really strange part is that it doesn't seem to be a system wide problem, Terminal Server sessions have perfectly working streams. Its just the Services, and actually, just their child processes. Also, even though there isn't a problem opening new file handles, nothing is inherited by child processes. So god help you if you expected to be able to setup stdout to point to a file, spawn a child, and have the child write to that file.

Sigh.

No comments: