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
-1
votes
1 answer

Panic:index out of range error in Golang

In this program, I'm trying to calculate the shortest path between any two squares on chess board according to the moves of the knight, I checked few websites they say something about finding out the length, I ddint quiet understand how to work…
Riya
  • 39
  • 11
-1
votes
1 answer

Analyzing RAM dump in Android

In case of Kernel Panic in Android we dump all RAM data in a file. In this case RAM addresses are Physical addresses. But in logs if we print address of any variable then that address is Virtual address. From dump if I want to know what data is…
user2806748
  • 11
  • 2
  • 5
-2
votes
1 answer

Runtime panic on calling resource from another package

I am trying to create a simple API server using fiber + zap + pgx I am getting an error which I am unable to solve. PS C:\Users\risharan\Documents\GitHub\freya> go run .\src\freya.go panic: runtime error: invalid memory address or nil pointer…
Rishav Sharan
  • 2,763
  • 8
  • 39
  • 55
-2
votes
1 answer

Go not receiving error will trigger panic but receiving error will not trigger panic

With the following code: var i interface{} = "hello" f, ok := i.(float64) fmt.Println(f, ok) f = i.(float64) // panic fmt.Println(f) Why is not catching error will cause panic but catching error will not cause a panic? Any documentation or…
-2
votes
1 answer

Why does one of my two slices panic with "runtime error: index out of range"?

func main() { str1 := make([]string, 10) str2 := []string{} fmt.Println(str1[0]) *No error* fmt.Println(str2[0]) *error* } Why does fmt.Println(str2[0]) show an error in Go?
thoufee
  • 19
  • 4
-2
votes
1 answer

Intercepting errors and panics in Go

I'm creating a CLI just to learn a bit more about Go. Is it possible to intercept all errors and panics, so I can have one unique place to handle them, and also format it and after print to stdout. Example: Instead of using: x, err :=…
Amanda Ferrari
  • 1,168
  • 5
  • 17
  • 30
-2
votes
1 answer

global variable not accessible to methods when used with testing

I am facing problem while using Golang Testing.Global variable not accessible to methods. Following is the code snippet test1.go var map1 = make(map[string]string) func f()(req *http.Request) (ismime bool, map1 map[string]string, err error) { …
nikhil
  • 877
  • 3
  • 11
  • 36
-2
votes
1 answer

fedora 27 kernel panic 4.16.7-200.fc27.x86_64

For a fedora 27 vm running on a fedora 28 host, I did an "dnf update" and i'm now getting this kernel panic. How do I troubleshoot it?
swv
  • 691
  • 1
  • 12
  • 28
-2
votes
1 answer

How to catch panic when HTTP client make request to unavailable url?

I need to make request to some URLs. It is possible, that someone of them is unavailable. It is OK for me, and I want just ignore these URLs. My problem is I cannot catch error, which is occurs. I get a error message: 2018/01/13 18:46:24 Get…
Max
  • 1,803
  • 3
  • 25
  • 39
-2
votes
1 answer

HTTP.Server Shutdown Causes Runtime Error

I have a goroutine written in Go 1.9.2 on darwin/amd64 that causes a runtime error: invalid memory address or nil pointer dereference. I think it's because of a race condition of some kind related to the order of routines exiting, but I'm not…
Bart Silverstrim
  • 3,445
  • 6
  • 34
  • 44
-3
votes
1 answer

How do I handle errors in a deferred function?

func someFunc() (err error) { defer func(err_ error) { r.handleErrOrPanic(err_, obj) }(err) // err is always nil here err = ThrowErrOrPanic(ctx, obj) return err } I would like to use handleErrOrPanic as a deferred function…
User12547645
  • 6,955
  • 3
  • 38
  • 69
-3
votes
2 answers

Does golang support global recovery?

I have a program with lots of goroutines, and I want to handle the panic globally. It looks like I have to add a recovery in each of the goroutines, is there a way to do it globally? I wrote a test program and I add a recover() in main, but it won't…
daisy
  • 22,498
  • 29
  • 129
  • 265
-3
votes
1 answer

Why getting panic in Rust program with an expect

Beginner Rust fan - I am getting a panic for either one of these. I expected it from the first part, but not the second. What am I missing? fn main() { //let age = "4a"; //let age2: i32 = age.trim().parse().unwrap(); //println!("{:?}",…
ecorrales
  • 137
  • 11
-3
votes
1 answer

panic: index out of range in Go when trying to access string element

I am currently learning how to code in Go and I am stuck with a problem that happen at line 43 and 44 of my code, i am trying to convert one element of "num" and "den" into a number so i can later use it do the calculation i want but i get the…
Fosowl
  • 29
  • 1
  • 5
-3
votes
1 answer

single partition & no initramfs linux boot gets kernel panic

compiled a kernel using gentoo specifications for Thinkpad T430 mounted empty ext4 hard drive and created boot/ directory on it, moved bzImage and System.map inside Installed extlinux to it with "extlinux --install [mounted directory]/boot" placed…
1 2 3
18
19