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
15
votes
3 answers

Golang panic crash prevention

In Golang a panic without a recover will crash the process, so I end up putting the following code snippet at the beginning of every function: defer func() { if err := recover(); err != nil { fmt.Println(err) } }() just in order to…
user1663023
12
votes
5 answers

How to detect panic(nil) and normal execution in deferred function Go?

The go runtime can detect panic(nil) and reports an error. However, I can't detect panic(nil) with recover() in a deferred function because it returns nil, so I cannot differentiate it from normal execution (no panic) as I would test for the return…
eonil
  • 83,476
  • 81
  • 317
  • 516
11
votes
2 answers

Retrieving backtrace from a panic in hook in Rust?

My application needs to send logs to fluentd as JSON format through stdout. While I'm trying to handle panics and arrange a &std::panic::PanicInfo as a JSON with std::panic::set_hook, I could not find a way to retrieve backtrace from a &PanicInfo. …
KUNIMI Taiyoh
  • 140
  • 1
  • 8
11
votes
1 answer

Safe close connection in Golang

When I open a socket connection, I immediately put the socket.Close() logic in a defer function after the opening of the socket. However, what if the socket.Close() would cause another panic? Should I always nest another defer/recover inside the…
user1663023
10
votes
1 answer

Recover and continue for loop if panic occur Golang

so my case is quite complex but for asking question in clean and clear context I am using simple for loop that initiate from 0 and goes upto 10. Now what I am trying to do is when i becomes equal to 2 program will consider this as panic. It will go…
Ahsan Naseem
  • 1,046
  • 1
  • 19
  • 38
10
votes
3 answers

Can I recover from panic, handle the error, then panic again and keep the original stack trace?

Is it possible to "rethrow" an error from recover and keep the original stack trace? The best I know how to do is to panic again, but that does create a new stacktrace. func do() { defer func() { cleanUp() if x := recover(); x !=…
user7610
  • 25,267
  • 15
  • 124
  • 150
10
votes
1 answer

does kernel's panic() function completely freezes every other process?

I would like to be confirmed that kernel's panic() function and the others like kernel_halt() and machine_halt(), once triggered, guarantee complete freezing of the machine. So, are all the kernel and user processes frozen? Is panic() interruptible…
user1284631
  • 4,446
  • 36
  • 61
9
votes
0 answers

Is it possible to unwind on panic in `#![no_std]` mode?

Is it possible to unwind on panic in #![no_std] mode, e.g. with a customized #[panic_handler]?
updogliu
  • 6,066
  • 7
  • 37
  • 50
9
votes
1 answer

use trace-cmd/ftrace to get function_graph just before panic() happened

I am trying to use trace-cmd to gather more information about a kernel crash that I am seeing. Unfortunately, kernel crashes with "kernel panic - not syncing" message (i.e. socket and file buffers are not flushed so whatever was in the buffers at…
user389238
  • 1,656
  • 3
  • 19
  • 40
9
votes
1 answer

What is RUST_BACKTRACE supposed to tell me?

My program is panicking so I followed its advice to run RUST_BACKTRACE=1 and I get this (just a little snippet). 1: 0x800c05b5 - std::sys::imp::backtrace::tracing::imp::write::hf33ae72d0baa11ed at…
boss revs
  • 331
  • 2
  • 4
  • 13
9
votes
2 answers

How to recover from concurrent map writes?

How do you recover from a runtime panic on a "concurrent map read and map write"? The usual defer with recover doesn't seem to work. Why is that? I know that you are not supposed to use maps in concurrent contexts, but still: how to recover…
Igor Lankin
  • 1,416
  • 2
  • 14
  • 30
9
votes
1 answer

understanding kernel oops error code

in kernel oops of ARM following logs are printed in kernel logs - <1>[ 4205.112835] I[0:swapper/0:0] [c0] Unable to handle kernel paging request at virtual address ff898580 <1>[ 4205.112874] I[0:swapper/0:0] [c0] pgd = ec3c4000 <1>[ 4205.112901]…
Pankaj Gupta
  • 309
  • 2
  • 10
9
votes
2 answers

What does "not syncing" mean in kernel panic?

What is meant by "not syncing" in a kernel panic message? I have read that it means that the kernel successfully synced data to disk, but am not sure. A typical context would be: "Kernel panic - not syncing - Attempted to kill init!"
Demi
  • 3,535
  • 5
  • 29
  • 45
9
votes
5 answers

linux: running self compiled kernel in qemu: VFS: Unable to mount root fs on unknown wn-block(0,0)

I try to get this running and don't know what I'm doing wrong. I have created an Debian.img (disk in raw format with virtual device manager - gui to libvirt I guess) and installed debian with no troubles. Now I want to get this running with a self…
Konstantin
  • 331
  • 1
  • 3
  • 8
7
votes
2 answers

Alternatives to panic!() and expect() for --release?

In development, my code uses .expect() and panic!() to handle fatal errors. Their behaviour is exactly what I need during development. When I compile with --release, I was hoping that their output would become more succinct. i.e. This code: let mut…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
1
2
3
18 19