[Haskell-cafe] Re: readFile problem

Stefan Aeschbacher haskell at aeschbacher.ch
Fri Jan 12 05:13:02 EST 2007


I finally found and solved the problem. The problem was in a small
library I wrote which handles threads. When a thread executed its
error handler, it started to kill (with throwTo) all other threads in
the group he belongs to. Unfortunately all other threads started their
error handlers too and started killing all other threads (again). The
resulting thunderstorm of throwTos lead to the strange behaviour I



2007/1/8, Stefan Aeschbacher <haskell at aeschbacher.ch>:
> Hi
> I am writing a network server in haskell. Lately I seem to have
> introduced a new bug. On Linux, when a client closes the connection to
> the server, the server dumps core. On Windows, the error message there
> is way different from the core dump on Linux. It says:
> application.exe: config.xml: openFile: does not exist (No such file or
> directory)
> I use readFile to read the config file. I tried to print out the
> config file after it is read to make sure that it is completely read.
> I only load this config file exactly once during program
> initialization. The config is used long before the crash. I printed
> the current working dir in the exception handler and there is
> something interesting. Instead of the path to the application, it is
> "\C:\\WINDOWS\\system32".
> There are many things i do not understand. Why the different behaviour
> on Linux and Windows? Shouldn't an exception be thrown on Linux
> instead of a core dump? I don't use any unsafePerformIO or foreign
> calls. Why the changed path? I never change working directory in my
> code. Why is a function (-> reading the config file) re-evaluated at a
> later point in time?
> How can I debug such a problem?
> My environement is ghc 6.6 on Ubuntu or Windows XP.
> thanks for any ideas
> Stefan

More information about the Haskell-Cafe mailing list