Skip to content

panic: runtime error: invalid memory address or nil pointer dereference #397

Closed
@0PandaDEV

Description

@0PandaDEV

Describe the bug
When I attempt to run fan2go I get following log/error:

~ sudo fan2go                                                                          
███████  █████  ███    ██ ██████   ██████   ██████  
██      ██   ██ ████   ██      ██ ██       ██    ██ 
█████   ███████ ██ ██  ██  █████  ██   ███ ██    ██ 
██      ██   ██ ██  ██ ██ ██      ██    ██ ██    ██ 
██      ██   ██ ██   ████ ███████  ██████   ██████  

 INFO  Version: 0.10.0
 INFO  Using configuration file at: /etc/fan2go/fan2go.yaml
 INFO  Starting Webserver...
 INFO  Starting REST api server...
⇨ http server started on 127.0.0.1:9001
 INFO  Gathering sensor data for gpufan1...
 INFO  Gathering sensor data for gpufan2...
 INFO  Loading fan curve data for fan 'gpufan1'...
 INFO  Loading fan curve data for fan 'gpufan2'...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55a503976462]

goroutine 167 [running]:
github.com/markusressel/fan2go/internal/persistence.persistence.SaveFanRpmData({{0xc00024ebd0?, 0x55a5042777a8?}}, {0x55a503d92fc0, 0xc0002524b0})
	github.com/markusressel/fan2go/internal/persistence/persistence.go:85 +0x122
github.com/markusressel/fan2go/internal/controller.(*DefaultFanController).runInitializationIfNeeded(0xc0002ae210)
	github.com/markusressel/fan2go/internal/controller/controller.go:295 +0x188
github.com/markusressel/fan2go/internal/controller.(*DefaultFanController).Run(0xc0002ae210, {0x55a503d8c110, 0xc0002ec320})
	github.com/markusressel/fan2go/internal/controller/controller.go:194 +0x16a
github.com/markusressel/fan2go/internal.RunDaemon.func7()
	github.com/markusressel/fan2go/internal/backend.go:141 +0x3f
github.com/oklog/run.(*Group).Run.func1({0xc00023d4c0?, 0xc00024a9d8?})
	github.com/oklog/[email protected]/group.go:38 +0x29
created by github.com/oklog/run.(*Group).Run in goroutine 1
	github.com/oklog/[email protected]/group.go:37 +0x5a

Desktop (please complete the following information):

  • Distro: EndeavourOS (Arch Linux)
  • uname -a: Linux PandaDEV 6.14.10-arch1-1 Verify that fans don't stop #1 SMP PREEMPT_DYNAMIC Wed, 04 Jun 2025 18:52:35 +0000 x86_64 GNU/Linux
  • sensors -v: sensors version 3.6.2 with libsensors version 3.6.2
  • fan2go version: 0.10.0

Additional context
My config file:

dbPath: "/etc/fan2go/fan2go.db"

runFanInitializationInParallel: false
maxRpmDiffForSettledFan: 20
fanResponseDelay: 2

tempSensorPollingRate: 200ms
tempRollingWindowSize: 10

rpmPollingRate: 1s
rpmRollingWindowSize: 10

fanController:
  adjustmentTickRate: 200ms
  pwmSetDelay: 5ms

sensors:
  - id: gpu_temp
    nvidia:
      device: nvidia-10DE2504-0100
      index: 1

curves:
  - id: gpu_curve
    linear:
      sensor: gpu_temp
      steps:
        - 40: 0
        - 50: 50
        - 70: 255

fans:
  - id: gpufan1
    nvidia:
      device: nvidia-10DE2504-0100
      index: 1
    curve: gpu_curve
    neverStop: true
    minPwm: 30
    maxPwm: 255
    controlAlgorithm:
      direct:
        maxPwmChangePerCycle: 10

  - id: gpufan2
    nvidia:
      device: nvidia-10DE2504-0100
      index: 2
    curve: gpu_curve
    neverStop: true
    minPwm: 30
    maxPwm: 255
    controlAlgorithm:
      direct:
        maxPwmChangePerCycle: 10

statistics:
  enabled: false
  port: 9000

api:
  enabled: true
  host: localhost
  port: 9001

profiling:
  enabled: false
  host: localhost
  port: 6060

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions