[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ISAPI Extension



Quoting Greg Pettyjohn:
> 2. Whenever Scheme has an error, the error is reported to the log
> file *and* Apache crashes. msdev did catch this one it's in eval.c

You need to wrap your top-level call to eval/apply to catch error
escapes. Based on the snippet, you want:

 if (!scheme_setjmp(scheme_error_buf)) {
   scheme_apply(scheme_load("MzISAPI.ss"), 1, (Scheme_Object **)&xcb);
 }

> BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID ptr ){return
> TRUE;}
> // end snippet
> 
> I'm not sure where I should put the Scheme init stuff. 
> I originally had it in the HttpExtensionProc but I thought that it might get
> called more than once,
> (which I suppose is a bad thing) so I stuck it in the GetExtensionVersion
> hoping that that my cure
> some of my pains. Is there a better place to put it? Might Windows honor
> some standard export that gets
> called only when the *any* dll is initially loaded? (Don't know too much
> about dlls)

I think you want to put it in DllMain, when it's called with
DLL_PROCESS_ATTACH as the `reason'. Not sure, though.

> 4. Direct your attention to "Exhibit A" in the above code. Here I have it
> hardcoded to load a file called
> "MzISAPI.ss" The result of which should be a scheme proc that gets applied
> to an extension control block.
> The catch is that if you don't have MzISAPI.ss in the right directory, you
> get a scheme error and a subsequent
> crash. Bummer. This is seems like a bad way to do it. Anyone got a better
> idea?

You could catch the MzScheme exception and inspect (or propagate) the
error message. _Inside MzScheme_ provides code to do that in the
"Temporarily Catching Error Escapes" section.

> 5. My little ISAPI extension is *intermittently* crashing. I suppose I'll
> just have to sweat it out and find out why.
> Anyone wanna help?

I worry that it's the GC, since it sounds like there is more than one
thread: Apache's thread and the MzScheme thread.

Quoting an earlier message:

 The Windows GC problem: even if MzScheme functions are only used in a
 single OS thread, the conservative garbage collector can get tripped
 up by threads under Windows. The collector finds static variables by
 scanning all mapped memory pages. If one thread unmaps a page while
 another one is running the collector, the collector can segfault. To
 solve this problem, the collector needs to be compiled for multiple
 threads and as a DLL. Then, the collector can see all threads ever
 created, and it can stop them while collecting.

but when MzScheme is loaded as a DLL into a different process, I don't
think compiling GC for threads and as a DLL solves the problem.

There must be a solution to this problem. I'll work on it in the very
near future.

> 6. Everytime I use this thing, I get the following error in the Log file:
> [Fri Mar 03 20:55:13 2000] [error] [client 10.0.1.191] (2)No such file or
> directory: ISA sent invalid headers

I don't know enough about Apache to offer much help here.

Matthew