Lines 749-754
Link Here
|
749 |
return NULL; |
749 |
return NULL; |
750 |
} |
750 |
} |
751 |
|
751 |
|
|
|
752 |
|
753 |
#ifdef WIN32 |
754 |
/* FcgidWin32PreventOrphans |
755 |
* |
756 |
* When Apache process gets recycled or shutdown abruptly, CGI processes |
757 |
* spawned by mod_fcgid will get orphaned. Orphaning happens mostly when |
758 |
* Apache worker threads take more than 30 seconds to exit gracefully. |
759 |
* |
760 |
*/ |
761 |
const char *set_win32_prevent_process_orphans(cmd_parms *cmd, void *dummy, char *arg) |
762 |
{ |
763 |
server_rec *s = cmd->server; |
764 |
fcgid_server_conf *config = ap_get_module_config(s->module_config, &fcgid_module); |
765 |
|
766 |
if (config != NULL && config->hJobObjectForAutoCleanup == NULL){ |
767 |
|
768 |
/* Create Win32 job object to prevent CGI process oprhaning |
769 |
*/ |
770 |
JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = { 0 }; |
771 |
config->hJobObjectForAutoCleanup = CreateJobObject(NULL, NULL); |
772 |
|
773 |
if (config->hJobObjectForAutoCleanup == NULL){ |
774 |
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, |
775 |
"mod_fcgid: Error enabling CGI process orphan prevention: %d " |
776 |
"unable to create job object.", apr_get_os_error()); |
777 |
return NULL; |
778 |
} |
779 |
|
780 |
/* Set job info so that all spawned CGI processes are associated with mod_fcgid |
781 |
*/ |
782 |
job_info.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; |
783 |
if(SetInformationJobObject(config->hJobObjectForAutoCleanup, |
784 |
JobObjectExtendedLimitInformation, &job_info, sizeof(job_info)) == 0){ |
785 |
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, |
786 |
"mod_fcgid: Error enabling CGI process orphan prevention: %d " |
787 |
"unable set job object information.", apr_get_os_error()); |
788 |
CloseHandle(config->hJobObjectForAutoCleanup); |
789 |
config->hJobObjectForAutoCleanup = NULL; |
790 |
return NULL; |
791 |
} |
792 |
|
793 |
ap_log_error(APLOG_MARK, APLOG_INFO, 0, NULL, |
794 |
"mod_fcgid: Enabled CGI process orphaning prevention flag."); |
795 |
} |
796 |
|
797 |
return NULL; |
798 |
} |
799 |
#endif /*WIN32*/ |
800 |
|
752 |
fcgid_cmd_conf *get_access_info(request_rec * r, int *authoritative) |
801 |
fcgid_cmd_conf *get_access_info(request_rec * r, int *authoritative) |
753 |
{ |
802 |
{ |
754 |
fcgid_dir_conf *config = |
803 |
fcgid_dir_conf *config = |