Repository navigation
Open
Labels
C-is-this-doneIt is unclear if the issue has been resolved
Description
Applying this seemingly innocent patch to Servo made multiprocess stop working on #12563. I reverted it in that PR. I'm sure there's a logic reason for that, but meanwhile I'm filling this pending further investigation, so I don't forget about it.
diff --git a/components/servo/main.rs b/components/servo/main.rs
index a13c2ca..31d9b28 100644
--- a/components/servo/main.rs
+++ b/components/servo/main.rs
@@ -93,19 +93,21 @@ fn main() {
None
};
- // TODO: once log-panics is released, this can be replaced by
- // log_panics::init();
- panic::set_hook(Box::new(|info| {
- warn!("Panic hook called.");
- let msg = match info.payload().downcast_ref::<&'static str>() {
- Some(s) => *s,
- None => match info.payload().downcast_ref::<String>() {
- Some(s) => &**s,
- None => "Box<Any>",
- },
- };
- error!("{}", msg);
- }));
+ if opts::get().panic_hook {
+ // TODO: once log-panics is released, this can be replaced by
+ // log_panics::init();
+ panic::set_hook(Box::new(|info| {
+ warn!("Panic hook called.");
+ let msg = match info.payload().downcast_ref::<&'static str>() {
+ Some(s) => *s,
+ None => match info.payload().downcast_ref::<String>() {
+ Some(s) => &**s,
+ None => "Box<Any>",
+ },
+ };
+ error!("{}", msg);
+ }));
+ }
setup_logging();
diff --git a/components/util/opts.rs b/components/util/opts.rs
index 7092643..388508b 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -83,6 +83,10 @@ pub struct Opts {
pub headless: bool,
pub hard_fail: bool,
+ /// Whether to install a custom panic hook or not. Default is true, turn to
+ /// false for easier debugging.
+ pub panic_hook: bool,
+
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
/// intrinsic widths are computed as a separate pass instead of during flow construction. You
/// may wish to turn this flag on in order to benchmark style recalculation against other
@@ -475,6 +479,7 @@ pub fn default_opts() -> Opts {
load_webfonts_synchronously: false,
headless: true,
hard_fail: true,
+ panic_hook: true,
bubble_inline_sizes_separately: false,
show_debug_borders: false,
show_debug_fragment_borders: false,
@@ -540,6 +545,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
"A user stylesheet to be added to every document", "file.css");
opts.optflag("z", "headless", "Headless mode");
opts.optflag("f", "hard-fail", "Exit on thread failure instead of displaying about:failure");
+ opts.optflag("", "no-panic-hook", "Don't install a panic hook");
opts.optflag("F", "soft-fail", "Display about:failure on thread failure instead of exiting");
opts.optflagopt("", "devtools", "Start remote devtools server on port", "6000");
opts.optflagopt("", "webdriver", "Start remote WebDriver server on port", "7000");
@@ -779,6 +785,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
load_webfonts_synchronously: debug_options.load_webfonts_synchronously,
headless: opt_match.opt_present("z"),
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"),
+ panic_hook: !opt_match.opt_present("no-panic-hook"),
bubble_inline_sizes_separately: bubble_inline_sizes_separately,
profile_script_events: debug_options.profile_script_events,
profile_heartbeats: debug_options.profile_heartbeats,
--
2.9.0Metadata
Metadata
Assignees
Labels
C-is-this-doneIt is unclear if the issue has been resolved
Activity
asajeffrey commentedon Jul 29, 2016
Er, why would we want to switch off the custom panic hook? This will stop crash reporting. If we do want to do this, perhaps we should rename the option to
no-crash-reportingto make this clearer?emilio commentedon Jul 29, 2016
Basically to allow easier debugging. I'd be fine with any name in fact.
asajeffrey commentedon Jul 29, 2016
OK, seems reasonable.
nox commentedon Oct 4, 2017
@emilio What's the status on this?