In fact i have the same problem reading files too. It only reads files up to a certain amount of bytes then crashes in the same manner explained above. Again this only happens when the program runs as a daemon.