Skip to content

app crash if "invalid memory address or nil pointer dereference" #3965

@mediawall

Description

@mediawall

Description

signal 11 received but handler not on signal stack
mp.gsignal stack [0xc000170000 0xc000178000], mp.g0 stack [0x7f738a1ffe08 0x7f738a9ffa08], sp=0xc000920798
fatal error: non-Go code set up signal handler without SA_ONSTACK flag

refer issue: #2152

To Reproduce

add following code to Greet method:

func (g *GreetService) Greet(name string) string {

	go func() {
		defer func() {
			if err := recover(); err != nil {
				fmt.Printf("------------------------------%#v\n", err)
			}
		}()
		time.Sleep(5 * time.Second)
		var t *time.Time
		log.Println(t.Unix())
	}()

	return "Hello " + name + "!"
}

Expected behaviour

exception is recovered.
if put the method in test function, the exception could be recovered.

Screenshots

No response

Attempted Fixes

No response

System Details

# Wails
Version         | v2.9.2
Package Manager | apt   

# System
┌──────────────────────────────────────────────────────────────────────────────────┐
| OS           | Ubuntu                                                            |
| Version      | 24.04                                                             |
| ID           | ubuntu                                                            |
| Go Version   | go1.23.2                                                          |
| Platform     | linux                                                             |
| Architecture | amd64                                                             |
| CPU          | Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz                          |
| GPU 1        | Unknown                                                           |
| GPU 2        | GP102 [GeForce GTX 1080 Ti] (NVIDIA Corporation) - Driver: nvidia |
| Memory       | 98GB                                                              |
└──────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name    | Status    | Version                 |
| *docker    | docker.io       | Available | 26.1.3-0ubuntu1~24.04.1 |
| gcc        | build-essential | Installed | 13.3.0                  |
| libgtk-3   | libgtk-3-dev    | Available | 3.24.41-4ubuntu1.2      |
| libwebkit  | Unknown         | Not Found |                         |
| npm        | npm             | Installed | 10.9.0                  |
| *nsis      | nsis            | Installed | v3.09-4                 |
| pkg-config | pkg-config      | Installed | 1.8.1                   |
└───────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
Required package(s) installation details: 
  - libgtk-3: sudo apt install libgtk-3-dev
  - libwebkit: sudo apt install libwebkit2gtk-4.0-dev

Optional package(s) installation details: 
  - docker: sudo apt install docker.io

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingv2

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions