[Haskell-cafe] Re: readFile problem
Hi, 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 observed. regards Stefan 2007/1/8, Stefan Aeschbacher [EMAIL PROTECTED]: 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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] readFile problem
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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] readFile problem
On 1/8/07, Stefan Aeschbacher [EMAIL PROTECTED] wrote: 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. It may be difficult to say without seeing your code. Is it possible for you to post it, or at least a minimal test case that would illustrate the different errors on the different OSes? What Unix toolkit are you using when running ghc on Windows, if any (cygwin, mingw, both, neither?) Cheers, Kirsten -- Kirsten Chevalier* [EMAIL PROTECTED] *Often in error, never in doubt What is research but a blind date with knowledge? -- Will Henry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] readFile problem
2007/1/8, Kirsten Chevalier [EMAIL PROTECTED]: On 1/8/07, Stefan Aeschbacher [EMAIL PROTECTED] wrote: 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. It may be difficult to say without seeing your code. Is it possible for you to post it, or at least a minimal test case that would illustrate the different errors on the different OSes? What Unix toolkit are you using when running ghc on Windows, if any (cygwin, mingw, both, neither?) I know that it's difficult without code but unfortunately the whole program is already quite large (several thousand lines) and I wouldn't see how to extract a relevant test case at the moment as i have no real clue where to search for the problem. I use cygwin on Windows. I just compiled the application from a cmd.exe and the result is the same (even though cmd.exe (and the normal cygwin terminal) swallows the error message, but the error is shown when run in rxvt). regards Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] readFile problem
Hi Stefan, 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. Are you using any calls to system? Any libraries which may do funky stuff? 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. What is the working directory at the begining? Is that really the working directory? The \C at the start isn't the C drive, but some bizare escape code, I think. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] readFile problem
Hi 2007/1/8, Neil Mitchell [EMAIL PROTECTED]: Hi Stefan, 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. Are you using any calls to system? Any libraries which may do funky stuff? No calls to system. Libraries I use: MissingH (only some time function) and HaXML. 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. What is the working directory at the begining? Is that really the working directory? The \C at the start isn't the C drive, but some bizare escape code, I think. Oups, I think i must have slipped that first \ in by mistake during the composition of the mail. The path at the start of the application is d:\development\simulator_v2 and when the error occurs it is C:\WINDOWS\system32 (without the show i used before). In the last hours I found out the following: the program looks something like this: main = do withSocketsDo $ runSimulator runSimulator = do dir - getCurrentDirectory putStrLn (Dir is: ++ dir) config - readConfig fork many threads It seems as if runSimulator is executed twice when the error happens. The first time dir is printed correctly (d:...). Then the application starts, all threads are created and it runs normally. When the client closes the socket the error: socket: 1832: hGetChar: failed (Unknown error) happens (which in my eyes should rather be isEOFError?). Then the withSocketsDo seems to execute runSimulator again (dir then is C:...). thanks Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: a readFile problem
It would probably be helpful if you were to post the code you have and explain what part isn't working. There's a function: readFile :: FilePath - IO String (FilePath is just a String) which reads a file. This should be what you need to solve this exercise... - Hal -- Hal Daume III | [EMAIL PROTECTED] Arrest this man, he talks in maths. | www.isi.edu/~hdaume On Mon, 2 Jun 2003, Naudts, Guido wrote: Hallo, I have the following problem: my program asks the user for a command, when the command is executed a new command is asked (this is no problem ; an example is in the HUgs distribution namely Main.hs in the Prolog example. However one of the commands is: read filename i.e. read a file and display it. I do not succeed in implementing this. Could anyone give an example of: reading commands in a loop where one of the commands is the read command mentionned above. Or is it not possible in Haskell? I have already wated a lot of time on this, so if anyone gives me an answer I will be very gratefull. Greetings, ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
a readFile problem
Hallo, I have the following problem: my program asks the user for a command, when the command is executed a new command is asked (this is no problem ; an example is in the HUgs distribution namely Main.hs in the Prolog example. However one of the commands is: read filename i.e. read a file and display it. I do not succeed in implementing this. Could anyone give an example of: reading commands in a loop where one of the commands is the read command mentionned above. Or is it not possible in Haskell? I have already wated a lot of time on this, so if anyone gives me an answer I will be very gratefull. Greetings,begin:vcard n:Guido;Naudts, Guido tel;fax:02/538.01.80 tel;home:014/51.32.43 tel;work:02/542.76.01 x-mozilla-html:TRUE url:http://www.just.fgov.be org:Ministerie van Justitie;Algemene Diensten adr:;;Eversstraat 2-8;Brussel;;1000;Belgium version:2.1 email;internet:[EMAIL PROTECTED] title:Informaticus x-mozilla-cpt:;-30680 fn:Naudts, Guido end:vcard