
Rich Fought wrote:
Hello,
I have a server application that I am building using GHC 6.4 (yes, an update to 6.4.2 is on the horizon, but not in the immediate future - unless it fixes this problem :) ) under MSYS/MinGW. Things work pretty well, but under stress testing the app eventually throws a Windows memory access violation (c0000005) exception out of the exact same location in the regcomp function every time. When it occurs is not deterministic - it could be after 20 requests or 2000 (usually higher, though). Various Windows debuggers shows it as a memory read error.
regcomp is called several times with each incoming request. I'm pretty sure it's not a multi-threading issue, as there is only one client sending requests over and over again.
Can anyone suggest some ideas or debugging tips?
TIA, Rich
Your code is using the provided Text.Regex code. To avoid the regcomp call, you could use darcs to get my replacement, Text.Regex.Lazy: darcs get http://evenmere.org/~chrisk/trl/stable/ or darcs get http://evenmere.org/~chrisk/trl/head/ (They have the same code right now. The tarball at sourceforge, http://sourceforge.net/projects/lazy-regex ,is missing a file but the darcs repository should be complete). If you compile and install and "import Text.Regex.Lazy.Compat" then you should get a drop in replacement for Text.Regex that may even perform faster. This uses pure Haskell (especially Parsec) to emulate the behavior of Text.Regex. Any reported difference in behavior will be treated as a bug. The code also has different modules for doing fancier regular expressions (T.R.L.Full) and for using a very fast DFA engine (T.R.L.CompatDFA). The library should work but the design is changing/improving except for T.R.L.Compat which has the same interface as Text.Regex. If your stress test still dies, then it will not be a problem with regcomp. -- Chris Kuklewicz