Questions tagged [panic]

A condition of the the operating system when its state is so broken that imminent shutdown is preferred.

A condition of the the operating system when its state is so broken that imminent shutdown is preferred. This may be caused by hardware failure but is also frequently caused by various kernel bugs, driver bugs, misconfigurations and attempts to use incompatible modules.

It often would be possible to continue the work of the operating system in this condition but this could result the data loss. Hence the shutdown is preferred.

279 questions
7
votes
2 answers

How does a caller function to recover from child goroutine's panics

I used to think the panic in a goroutine will kill the program if its caller finishes before the panic (the deferred recovering gives no help since at that point there's no panic occurs yet), until I tried following code: func fun1() { …
Dave Wu
  • 145
  • 3
  • 8
7
votes
2 answers

golang :how do I handle index out of range error?

I am writing a CLI interface program in Go.my program requires a user to enter a filename as an argument . following is the code I wrote to handle the situations in which user doesn't enter any argument . but it panics and gives an error "index…
6
votes
1 answer

Handling panics of external libraries

I am new to Rust and have come to understand Rust defaults to panics and not exceptions. I have a rust project that depends on external libraries. I have handled all unwraps and ?'s in my code using match statements, but I am not sure how to handle…
6
votes
2 answers

Mips Linux: Logging Kernel Panic into mtd partition

We are experiencing kernel panics in the field for our MIPS based embedded devices. How can I log the kernel panic trace in the MTD partition? Do we have to write the trace only into MTD or is it possible to write over the NFS? Can anyone explain…
user4117880
  • 135
  • 3
  • 9
5
votes
1 answer

Why is it that panic!(_) can be returned with or without a ;?

Looking at question number 3 here. As an example, I've edited as such. fn main() { never_return(); // println!("Failed!"); } fn never_return() -> ! { // Implement this function, don't modify the fn signatures panic!("stop") } The…
kenta_desu
  • 303
  • 1
  • 9
5
votes
0 answers

Remove project info from panic messages

How can I hide project info (like source code paths) from panic messages occurred while running a release build? Assume following code as a Minima Reproducible Example fn main() { println!("Hello!"); let v = vec![0]; println!("{:?}",…
Shimon S
  • 4,048
  • 2
  • 29
  • 34
5
votes
1 answer

Generic panic recovering in go programs

I’m trying to catch crashes/panics from go routines that are created in my program, in order to send them to my crash-error-reporting server (such as Sentry/Raygun) For example, func main() { go func() { // Get this panic …
Or Nahum
  • 173
  • 1
  • 1
  • 5
5
votes
3 answers

How can I silently catch panics in QuickCheck tests?

In the tests of my overflower_support crate, I have found that I get a lot of spurious reports of panics which are already handled using std::panic::catch_unwind(_). This is a bit unfortunate, as it obscures the real errors that may happen. The…
llogiq
  • 13,815
  • 8
  • 40
  • 72
4
votes
2 answers

What are all the ways rust might panic without explicitly calling unwrap/panic?

Recently I was writing a driver for a pressure sensor and was avoiding using floating-point instructions as the microcontroller I am using doesn't have a hardware FPU and emulated instructions are rather expensive. I made an error in the type I used…
silvergasp
  • 1,517
  • 12
  • 23
4
votes
1 answer

Why does unwrapping a cloned Rc cause a panic?

Why does this code panic on line 7? Shouldn't foo_unwrapped be Some(3) on line 5 instead of None? use std::rc::Rc; fn main() { let foo: Rc = Rc::new(3); let mut foo_cloned = Rc::clone(&foo); let mut foo_unwrapped = Rc::get_mut(&mut…
Uclydde
  • 1,414
  • 3
  • 16
  • 33
4
votes
2 answers

Where does the linux kernel panic message go?

I don't know if it's related to SO. I know that when I use the Linux kernel panic function, its job is to freeze my system, but it takes 1 argument, a message. Where can I actually see the message if my system is completely frozen and I force…
vmemmap
  • 510
  • 4
  • 20
4
votes
2 answers

Kernel panic with exitcode=0x00000004 after /init

I have an embedded ARM system with processor AT91SAM9G45. I try to build linux kernel with initramfs for this system. Kernel version is 4.14.79. After loading kernel and initramfs image at device I have following: Kernel definitely finds out…
vglv
  • 41
  • 1
  • 5
4
votes
4 answers

How to check value in nested pointer

How can I check nested pointer easily? type inner1 struct { value string } type inner2 struct { value *inner1 } type outter struct { value *inner2 } I have data like this: o := &outter{ value: &inner2{ value: &inner1{ …
Shahriar
  • 13,460
  • 8
  • 78
  • 95
4
votes
1 answer

Is there a macro to convert an Error to Panic?

Is there a macro that will convert an error into a panic, similar to the try macro? Do I need to define my own? For example I'd like to panic if a unit test can't open a file. My current workaround is this: macro_rules! tryfail { ($expr:expr) =>…
laktak
  • 57,064
  • 17
  • 134
  • 164
4
votes
1 answer

Golang filepath.Walk panic error on large directory

I am trying to walk through all files on the C drive which I read can be inefficient in Go, but I can't work out why I keep getting a panic error when doing this as I tell the walk function to return a nil error code. package files import ( …
mbudge
  • 557
  • 13
  • 28
1 2
3
18 19