Added code to the scheduler so that it will dump core on SEGV. This

is disabled by default.  Having this
is really useful if the scheduler is crashing some of the time.  You
can load the core dump file into a debugger to see where things are
breaking.  To use this, edit sched/main.C by hand and set
#define DUMP_CORE_ON_SEGV 1

svn path=/trunk/boinc/; revision=5385
This commit is contained in:
Bruce Allen 2005-02-10 16:50:37 +00:00
parent 65fca352bd
commit 5e98d1457d
2 changed files with 55 additions and 0 deletions

View File

@ -24462,3 +24462,15 @@ Bruce 10 Feb 2005
sched_send.C
sched_util.[hC]
Bruce 10 Feb 2005
Added code to the scheduler so that it will dump core on SEGV. This
is disabled by default. Having this
is really useful if the scheduler is crashing some of the time. You
can load the core dump file into a debugger to see where things are
breaking. To use this, edit sched/main.C by hand and set
#define DUMP_CORE_ON_SEGV 1
sched/
main.C

View File

@ -30,6 +30,8 @@ using namespace std;
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "boinc_db.h"
#include "parse.h"
@ -49,6 +51,11 @@ using namespace std;
#include "fcgi_stdio.h"
#endif
// Useful for debugging, if your cgi script keeps crashing. This
// makes it dump a core file that you can load into a debugger to see
// where the problem is.
#define DUMP_CORE_ON_SEGV 0
#define DEBUG_LEVEL 999
#define MAX_FCGI_COUNT 20
@ -122,6 +129,41 @@ int main() {
srand(time(0)+getpid());
log_messages.set_debug_level(DEBUG_LEVEL);
#if DUMP_CORE_ON_SEGV
{
struct rlimit limit;
if (getrlimit(RLIMIT_CORE, &limit)) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"Unable to read resource limit for core dump size.\n"
);
}
else {
char short_string[256], *short_message=short_string;
short_message += sprintf(short_message,"Default resource limit for core dump size curr=");
if (limit.rlim_cur == RLIM_INFINITY)
short_message += sprintf(short_message,"Inf max=");
else
short_message += sprintf(short_message,"%d max=", (int)limit.rlim_cur);
if (limit.rlim_max == RLIM_INFINITY)
short_message += sprintf(short_message,"Inf\n");
else
short_message += sprintf(short_message,"%d\n", (int)limit.rlim_max);
log_messages.printf(SCHED_MSG_LOG::DEBUG, "%s", short_string);
// now set limit to the maximum allowed value
limit.rlim_cur=limit.rlim_max;
if (setrlimit(RLIMIT_CORE, &limit)) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"Unable to set current resource limit for core dump size to max value.\n"
);
}
}
}
#endif
if (check_stop_sched()) {
send_message("Project is temporarily shut down for maintenance", 3600);
goto done;
@ -215,6 +257,7 @@ int main() {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't write reply file\n");
exit(1);
}
handle_request(fin, fout, *ssp, code_sign_key);
fclose(fin);
fclose(fout);