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
4
votes
2 answers

Redirect panics to a specified buffer

Is there any way to do this? In a terminal graphics library, if an exception occurs, the exception will be flushed away before being displayed, making programming very hard to debug using this library. impl Drop for Terminal { fn drop(&mut…
Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177
4
votes
2 answers

How to find exact line number of FreeBSD kernel panic?

I am testing a new driver on FreeBSD kernel. This might be trivial for experienced developers, but I can't figure out the solution to this problem. I have a kernel panic and when it panics, I get the backtrace of the panic. The backtrace says that…
Pratik Singhal
  • 6,283
  • 10
  • 55
  • 97
4
votes
2 answers

Is there any efficient way to get panic log of Go program under Unix easily?

Since I'm running a Go program as server, I need some mechanism to catch panic log if anything goes wrong for later analyze & debug. Is there any efficient way to get panic log of Go program under Unix easily? Can you guys introduce your experience…
Shane Hou
  • 4,808
  • 9
  • 35
  • 50
3
votes
1 answer

Why BUG_ON(!in_nmi()) was triggerd?

I got a kernel BUG, I don't know why it was triggered. [ 242.337362] kernel BUG at arch/x86/kernel/cpu/mce/core.c:1364! [ 242.337366] invalid opcode: 0000 [#1] SMP NOPTI This is CentOS 8.5, Kernel 4.18.0-348.el8.x86_64 on an x86_64. The core.c line…
GreenTea
  • 769
  • 1
  • 10
  • 36
3
votes
0 answers

Why does Golang terminate the whole process if one goroutine paincs?

According to Go's specifications: While executing a function F, an explicit call to panic or a run-time panic terminates the execution of F. Any functions deferred by F are then executed as usual. Next, any deferred functions run by F's caller are…
3
votes
1 answer

How to get panic information (i.e. stack trace) with `catch_unwind`?

If using set_hook, we can get lots of information, especially the stack trace - which is very helpful. However, with catch_unwind, I only get a Result which contains almost no useful information at all. Therefore, I wonder how to get panic…
ch271828n
  • 15,854
  • 5
  • 53
  • 88
3
votes
1 answer

Why does a panic while panicking result in an illegal instruction?

Consider the following code that purposely causes a double panic: use scopeguard::defer; // 1.1.0 fn main() { defer!{ panic!() }; defer!{ panic!() }; } I know this typically happens when a Drop implementation panics while unwinding from a…
kmdreko
  • 42,554
  • 6
  • 57
  • 106
3
votes
1 answer

Integer operation with boundary when overflow in Rust

The problem I recently meet requires to do integer operation with boundary based on the bits of integer type. For example, using i32 integer to do add operation, here's a piece of pseudo code to present the idea: sum = a + b max(min(sum,…
Kir Chou
  • 2,980
  • 1
  • 36
  • 48
3
votes
1 answer

Why does a test fail with the message "panicked at Box"?

Why does this panic? pub fn testbool() -> bool { vec!['a', 'd', 'i', 'e', 'p', 'r'] .iter() .enumerate() .find(|(_i, &c)| c != 'c') .is_none() } #[test] fn test_testbool() { assert!(testbool(),…
VsM
  • 710
  • 1
  • 10
  • 23
3
votes
2 answers

How can i catch the runtime.errorString in recover()?

I try to catch the panic func test(/*some input*/) (output string,err111 error) { defer func(){ if err := recover(); err != nil { output = "" err111 = errors.New(err.(string)) } }() .... } but…
cxm
  • 35
  • 6
3
votes
2 answers

Panic error on google cloud TPU

I can open a ctpu session and get the code I need from my git repository, but when I run my tensorflow code from the cloud shell, I get a message to say that there is no TPU and my program crashes. Here is the error message I…
3
votes
2 answers

How to avoid affecting other code when panic error or something else in golang

I am writing a monitor program that will merge into company's system. When the program running, seldom panicked some error since a variety of problem such as a few other's server doesn't obtain the rule of http, network error or anything else.I fix…
sohruin
  • 41
  • 2
3
votes
2 answers

How to detect a kernel panic after reboot

I have some unexpected reboot on a embedded device. I am currently able to detect a hardware watchdog issue thanks to an ioctl call. Now I would like be able to detect if a kernel panic was the reason for a reboot. I find some articles concerning…
ArthurLambert
  • 749
  • 1
  • 7
  • 30
3
votes
1 answer

How to recover from an asynchronous panic in external package

I'm learning Go and I'm trying to understand how to properly deal with panics from external packages. Here is a runnable example, say a package defines the doFoo method. (It's located in the same package here for the sake of the example ) package…
Willem D'Haeseleer
  • 19,661
  • 9
  • 66
  • 99
3
votes
1 answer

Why Go's bufio uses panic under the hood?

Reading the code from the bufio package I've found such things: // fill reads a new chunk into the buffer. func (b *Reader) fill() { ... if b.w >= len(b.buf) { panic("bufio: tried to fill full buffer") } ... } At the same…
Ivan Velichko
  • 6,348
  • 6
  • 44
  • 90