We've written a custom AOLServer module to provide our software's
functionality directly via an HTTP interface.  On Solaris, it runs as a
shared library.  In front of this is a series of Perl scripts (yes, yes, I
know, can't rewrite this right now) also served by the same nsd instance
that query our module and rewrite the results for presentation to the user.

We use an Ns_MutexLock/Ns_MutexUnlock pair to ensure that we don't have
reentrancy in the module (again, yes, yes, I know).  Our Ns_Mutex is static,
and is initialized using Ns_MutexInit.  Here's a sample from a small
function:

int GetStatistics(Ns_OpContext context, Ns_Conn *conn)
{
        Ns_MutexLock(&SpNebulaMutex);

        //Get the statistics from the HTTP administrator
        NQAdmin::Result statResult      = SHTTPAdmin->GetStatistics();

        //Send the resulting HTML to the server
        int Result = Ns_ConnReturnHtml(conn, statResult.m_iResult,
                        const_cast<char *>(statResult.m_sResult.c_str()),
statResult.m_sResult.length());
        Ns_MutexUnlock(&SpNebulaMutex);
        return Result;
}

NOW, the problem:

We in some instances appear to have a reentrancy problem.  Not 100% sure,
but in some heavy loading cases, a function that would fail if a re-entrant
call was made seems to fail with alarming regularity.  The first thing we
did was change the limit (of CGIs) to 1.  That helps, but not enough-it
still fails in the same way.

Any suggestions?  Thanks in advance....

--
Bill Hofmann                        ph: 510-525-7637
VP Engineering                  mobile: 510-409-0395
ZNOW Inc., 2342 Shattuck Ave #314, Berkeley CA 94704

Reply via email to