I have written a software that will act as a server to an application I've made. This works perfectly when I run it from the terminal but crashes every time on a very specific action when I run it as an Upstart service. I think it crashes when it reads from a file but it's hard to know using Haskell.
This is how I run it in the terminal (when it works):
cd /srv/MyApp/ sudo -u appServerUser -g appServerUser ./appServer
And this is my Upstart .conf (placed in /etc/init/) (which crashes):
start on runlevel  stop on runlevel [^2345] chdir /srv/MyApp/ setuid appServerUser setgid appServerUser respawn limit 5 5 exec ./appServer
Have I configured the Upstart incorrectly? Or why does the program behave differently when it should have the exact same privileges and is run from the same place.
I realised I was a bit incorrect about the program crashing. The program doesn't crash but the thread does.
FOUND THE SOURCE: After a lot of minification i realized it crashes when it's trying to read non-ASCII characters. Why it only fails when run as Upstart i beyond me, but I have found the problem and I would say it's a bug in the compiler or in Upstart.