tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45766] New: watchdog_interval issue in current svn version
Date Mon, 08 Sep 2008 20:06:04 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45766

           Summary: watchdog_interval issue in current svn version
           Product: Tomcat 6
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connectors
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: zdenek@datacrunch.net


watchdog_interval can be set to number of seconds for watchdog thread. The code
seems to indicate that if default value is used (0) that maintenance happens in
HttpExtensionProc

        if (!watchdog_interval)
            wc_maintain(logger);


however

static DWORD WINAPI watchdog_thread(void *param)
{
    if (JK_IS_DEBUG_LEVEL(logger)) {
        jk_log(logger, JK_LOG_DEBUG,
               "Watchdog thread initialized");
    }
    while (is_inited) {
        Sleep(watchdog_interval * 1000);
        if (!is_inited)
            break;
        // debug
        if (JK_IS_DEBUG_LEVEL(logger)) {
            jk_log(logger, JK_LOG_DEBUG,
                   "Watchdog thread running");
        }
        wc_maintain(logger);
    }
    return 0;
}

starts anyway creating gigabytes of log if in debug. I modified the code to:

static DWORD WINAPI watchdog_thread(void *param)
{
    if (JK_IS_DEBUG_LEVEL(logger)) {
        jk_log(logger, JK_LOG_DEBUG,
               "Watchdog thread initialized");
    }
    // check if no watchdog
    if (watchdog_interval == 0) break;
    while (is_inited) {
        Sleep(watchdog_interval * 1000);
        if (!is_inited)
            break;
        // debug
        if (JK_IS_DEBUG_LEVEL(logger)) {
            jk_log(logger, JK_LOG_DEBUG,
                   "Watchdog thread running");
        }
        wc_maintain(logger);
    }
    return 0;
}

which resolves the issue. I believe that was the original intent not to start
the watchdog thread. Probably the best would be not to start the thread in the
first place, by modifying tail end of init_jk

    if (rc) {
        HANDLE wt;
        DWORD  wi;
        wt = CreateThread(NULL, 0, watchdog_thread, NULL, 0, &wi);
        jk_log(logger, JK_LOG_INFO, "%s initialized", (VERSION_STRING) );
    }
    return rc;
}


to 

    if ((rc) && (watchdog_interval)) {
        HANDLE wt;
        DWORD  wi;
        wt = CreateThread(NULL, 0, watchdog_thread, NULL, 0, &wi);
        jk_log(logger, JK_LOG_INFO, "%s initialized", (VERSION_STRING) );
    }
    return rc;

but i have not tested this change yet.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message