On 9/11/07, Vasiljevic Zoran <[EMAIL PROTECTED]> wrote:
> void
> Ns_Fatal(CONST char *fmt, ...)
> {
> va_list ap;
>
> va_start(ap, fmt);
> LogAdd(Fatal, fmt, ap);
> va_end(ap);
>
> _exit(1); /**** <<<<< WHY THIS ????? */
> }
>
> Why not abort()?
It's called from many different places and a clean-shutdown is often a
reasonable thing to do..?
> This creates lots of troubles for us
> to nail-down such problems:
>
> nsd(17299,0xa000ed88) malloc: *** vm_allocate(size=471502848) failed
> (error code=3)
> nsd(17299,0xa000ed88) malloc: *** error: can't allocate region
> nsd(17299,0xa000ed88) malloc: *** set a breakpoint in szone_error to
> debug
> [11/Sep/2007:09:28:43][17299.2684415368][-main-] Notice: unable to alloc
> 471499774
> [11/Sep/2007:09:33:56][17299.2684415368][-main-] Fatal: unable to alloc
> 471499774 bytes
>
> I recall the Ns_Fatal bringing down the server and producing coredump.
> Now it just exists and we have no clue how to see where the fatal
> message is happening....
>
void *
ns_malloc(size_t size)
{
return ckalloc(size);
}
Tcl handles the checking for allocation failure and calls Tcl_Panic().
void
NsInitLog(void)
{
Ns_MutexSetName(&lock, "ns:log");
Ns_TlsAlloc(&tls, FreeCache);
AddClbk(LogToFile, (void*)STDERR_FILENO, NULL);
Tcl_SetPanicProc(Panic);
}
static void
Panic(CONST char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
LogAdd(Fatal, fmt, ap);
va_end(ap);
abort();
}
If a memory routine failed, I would expect the process to abort...
(Hmm, maybe there should be a flush after that LogAdd()...?)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
naviserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel