Debug Grafana server

Hello,
I am trying to debug Grafana Server.
When I run the server, attach delve, after I attach debugger. When I open UI it get stuck (no response). I tried compiling without optimizations (“-gcflags=all=-N -l”) didn’t help.
I also tried directly via IDE (“pkg/cmd/grafana”), when I run in debug it fails with segfault:

API server listening at: 127.0.0.1:40199
unexpected fault address 0xffffffffc1245470
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffffc1245470 pc=0x2323844]

goroutine 1 [running, locked to thread]:
runtime.throw({0x4dea20c?, 0xc00053e160?})
        /usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc000e094c0 sp=0xc000e09490 pc=0x44979d
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:842 +0x1ca fp=0xc000e094f0 sp=0xc000e094c0 pc=0x46088a
github.com/grafana/grafana/pkg/services/store/entity.init()
        /home/am/dev/ext/grafana/pkg/services/store/entity/entity.pb.go:36 +0x204 fp=0xc000e09600 sp=0xc000e094f0 pc=0x2323844
runtime.doInit(0x6e95d80)
        /usr/local/go/src/runtime/proc.go:6329 +0x132 fp=0xc000e09730 sp=0xc000e09600 pc=0x459352
...

I am running linux (kernel 6.1), intel cpu, golang 1.19.5.

:Hi @alexeymukas,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

Can you please tell as how exactly you installed Grafana e.g. via a package manager or build it from source?

Also, did you follow any documentation to debug Grafana like this? Can you please share?

Hello,
Did you manage to get it working? I’m trying to do the same thing and I’m facing the same issues. I’ve forked the repo and tried to attach a debugger to the server bug to no avail. Is there any documentation for this I can look into?