[mercury-users] Mercury runtime problem on Windows
pbone at csse.unimelb.edu.au
Fri Aug 14 10:18:40 AEST 2009
On Thu, Aug 13, 2009 at 10:28:42PM +1000, Michael Day wrote:
> Hi Paul,
>> AIUI this is for the detection and slightly-more-graceful handling of memory
>> access errors. In some places in the runtime we use mprotect() to ensure that
>> reads or writes to that memory are caught as errors, I forget exactly what this
>> is for but perhaps to catch stack overruns, this may be related to our SIGSERV
> In this case it seems that the signal handler is only necessary to give
> a suitable error message for runtime or program errors. Since in this
> case it is actually causing a serious error, and is not required for
> correct program operation, it would be nice if it were optional.
> Can this be done? It seems to be simply a matter of ignoring the return
> value, or perhaps printing a message or aborting only in debug grades?
I'm not convinced that this is a good idea. We need to determine if the signal
hander is required by our use of mprotect(). We also need to determine the
cause of this behaviour, we're still just guessing.
>> That's a good point. I'd recommend writing a C program that trys to install
>> signal handlers and spawning multiple copies of that program to see if this
>> problem occurs is independently of Mercury.
> I've tried this:
> #include <stdlib.h>
> #include <stdio.h>
> #include <signal.h>
> void handler(int x)
> int main()
> if (signal(SIGSEGV, handler) == SIG_ERR)
> return 0;
> Unfortunately I haven't been able to reproduce the problem yet.
This test doesn't match your description of how to reproduce the problem. You
said it occured whem multiple processes where running. Maybe this process
should not exit immediatly.
> We have also experienced this issue on Windows 2000 when running
> binaries linked with OpenSSL. The problem goes away when the binary is
> not linked with OpenSSL. I have no idea why this is, unless the OpenSSL
> library is doing something very tricky during initialisation. Since it
> is a static library, not a DLL, I'm not sure if that's even possible.
Is this a Mercury program?
I think this sort of thing is possible under Linux. I don't know about
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 489 bytes
Desc: Digital signature
More information about the users