Skip to content

Commit e117aa0

Browse files
committed
Stop logging task failure to task loggers
The isn't an ideal patch, and the comment why is in the code. Basically uvio uses task::unkillable which touches the kill flag for a task, and if the task is failing due to mismangement of the kill flag, then there will be serious problems when the task tries to print that it's failing.
1 parent 61ed2cf commit e117aa0

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/libstd/rt/task.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ pub fn begin_unwind(msg: *c_char, file: *c_char, line: size_t) -> ! {
546546
use rt::in_green_task_context;
547547
use rt::task::Task;
548548
use rt::local::Local;
549-
use rt::logging::Logger;
550549
use str::Str;
551550
use c_str::CString;
552551
use unstable::intrinsics;
@@ -573,16 +572,19 @@ pub fn begin_unwind(msg: *c_char, file: *c_char, line: size_t) -> ! {
573572
// have been failing due to a lack of memory in the first place...
574573
let task: *mut Task = Local::unsafe_borrow();
575574
let n = (*task).name.as_ref().map(|n| n.as_slice()).unwrap_or("<unnamed>");
575+
576+
// XXX: this should no get forcibly printed to the console, this should
577+
// either be sent to the parent task (ideally), or get printed to
578+
// the task's logger. Right now the logger is actually a uvio
579+
// instance, which uses unkillable blocks internally for various
580+
// reasons. This will cause serious trouble if the task is failing
581+
// due to mismanagment of its own kill flag, so calling our own
582+
// logger in its current state is a bit of a problem.
576583
match file.as_str() {
577584
Some(file) => {
578-
format_args!(|args| { (*task).logger.log(args) },
579-
"task '{}' failed at '{}', {}:{}",
580-
n, msg, file, line);
581-
}
582-
None => {
583-
format_args!(|args| { (*task).logger.log(args) },
584-
"task '{}' failed at '{}'", n, msg);
585+
rterrln!("task '{}' failed at '{}', {}:{}", n, msg, file, line);
585586
}
587+
None => rterrln!("task '{}' failed at '{}'", n, msg),
586588
}
587589
if (*task).unwinder.unwinding {
588590
rtabort!("unwinding again");

src/libstd/rt/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ pub fn default_sched_threads() -> uint {
7272
pub fn dumb_println(args: &fmt::Arguments) {
7373
use rt::io::native::stdio::stderr;
7474
use rt::io::{Writer, io_error, ResourceUnavailable};
75-
let mut out = stderr();
7675

76+
let mut out = stderr();
7777
let mut again = true;
7878
do io_error::cond.trap(|e| {
7979
again = e.kind == ResourceUnavailable;

0 commit comments

Comments
 (0)