mirror of https://github.com/BOINC/boinc.git
- client: fix memory leak when reading stderr of completed job.
This caused 128KB + size of stderr loss for each job. - client: print error message if reading stderr fails (e.g. because of malloc failure) svn path=/trunk/boinc/; revision=24336
This commit is contained in:
parent
f304e50691
commit
c7e505dc81
|
@ -6821,3 +6821,13 @@ Rom 5 Oct 2011
|
||||||
|
|
||||||
lib/
|
lib/
|
||||||
diagnostics.cpp
|
diagnostics.cpp
|
||||||
|
|
||||||
|
David 5 Oct
|
||||||
|
- client: fix memory leak when reading stderr of completed job.
|
||||||
|
This caused 128KB + size of stderr loss for each job.
|
||||||
|
- client: print error message if reading stderr fails
|
||||||
|
(e.g. because of malloc failure)
|
||||||
|
|
||||||
|
client/
|
||||||
|
app.h
|
||||||
|
app_control.cpp
|
||||||
|
|
|
@ -244,7 +244,7 @@ struct ACTIVE_TASK {
|
||||||
bool get_app_status_msg();
|
bool get_app_status_msg();
|
||||||
bool get_trickle_up_msg();
|
bool get_trickle_up_msg();
|
||||||
double est_dur();
|
double est_dur();
|
||||||
bool read_stderr_file();
|
int read_stderr_file();
|
||||||
bool finish_file_present();
|
bool finish_file_present();
|
||||||
bool temporary_exit_file_present(double&);
|
bool temporary_exit_file_present(double&);
|
||||||
void init_app_init_data(APP_INIT_DATA&);
|
void init_app_init_data(APP_INIT_DATA&);
|
||||||
|
|
|
@ -490,7 +490,12 @@ void ACTIVE_TASK::handle_exited_app(int stat) {
|
||||||
|
|
||||||
if (!will_restart) {
|
if (!will_restart) {
|
||||||
copy_output_files();
|
copy_output_files();
|
||||||
read_stderr_file();
|
int retval = read_stderr_file();
|
||||||
|
if (retval) {
|
||||||
|
msg_printf(result->project, MSG_INTERNAL_ERROR,
|
||||||
|
"read_stderr_file(): %s", boincerror(retval)
|
||||||
|
);
|
||||||
|
}
|
||||||
client_clean_out_dir(slot_dir, "handle_exited_app()");
|
client_clean_out_dir(slot_dir, "handle_exited_app()");
|
||||||
clear_schedule_backoffs(this);
|
clear_schedule_backoffs(this);
|
||||||
// clear scheduling backoffs of jobs waiting for GPU
|
// clear scheduling backoffs of jobs waiting for GPU
|
||||||
|
@ -772,7 +777,7 @@ int ACTIVE_TASK::abort_task(int exit_status, const char* msg) {
|
||||||
|
|
||||||
// check for the stderr file, copy to result record
|
// check for the stderr file, copy to result record
|
||||||
//
|
//
|
||||||
bool ACTIVE_TASK::read_stderr_file() {
|
int ACTIVE_TASK::read_stderr_file() {
|
||||||
char* buf1, *buf2;
|
char* buf1, *buf2;
|
||||||
char path[256];
|
char path[256];
|
||||||
|
|
||||||
|
@ -781,16 +786,22 @@ bool ACTIVE_TASK::read_stderr_file() {
|
||||||
//
|
//
|
||||||
int max_len = 63*1024;
|
int max_len = 63*1024;
|
||||||
sprintf(path, "%s/%s", slot_dir, STDERR_FILE);
|
sprintf(path, "%s/%s", slot_dir, STDERR_FILE);
|
||||||
if (!boinc_file_exists(path)) return false;
|
if (!boinc_file_exists(path)) return 0;
|
||||||
if (read_file_malloc(path, buf1, max_len, !config.stderr_head)) {
|
if (read_file_malloc(path, buf1, max_len, !config.stderr_head)) {
|
||||||
return false;
|
return ERR_MALLOC;
|
||||||
}
|
}
|
||||||
buf2 = (char*)malloc(2*max_len);
|
buf2 = (char*)malloc(2*max_len);
|
||||||
|
if (!buf2) {
|
||||||
|
free(buf1);
|
||||||
|
return ERR_MALLOC;
|
||||||
|
}
|
||||||
non_ascii_escape(buf1, buf2, 2*max_len);
|
non_ascii_escape(buf1, buf2, 2*max_len);
|
||||||
result->stderr_out += "<stderr_txt>\n";
|
result->stderr_out += "<stderr_txt>\n";
|
||||||
result->stderr_out += buf2;
|
result->stderr_out += buf2;
|
||||||
result->stderr_out += "\n</stderr_txt>\n";
|
result->stderr_out += "\n</stderr_txt>\n";
|
||||||
return true;
|
free(buf1);
|
||||||
|
free(buf2);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell a running app to reread project preferences.
|
// tell a running app to reread project preferences.
|
||||||
|
|
Loading…
Reference in New Issue