fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.1k stars 427 forks source link

Panic after pulling and building latest 4.56.0 branch #21635

Closed xpkoala closed 2 months ago

xpkoala commented 2 months ago

Fleet version: minor-fleet-v4.56.0

Web browser and operating system: N/A


💥  Actual behavior

After building, preparing, and starting the fleet server I encounter a panic.

🧑‍💻  Steps to reproduce

  1. Pull from the minor release branch
  2. Build and prepare the server
  3. Start the server ./build/fleet serve --dev --dev_license --vulnerabilities_databases_path=/tmp/vulndb --debug --logging_debug
  4. Panic at the disco

🕯️ More info (optional)

The server had been running off the same branch for the past several days.

panic: runtime error: slice bounds out of range [:12] with capacity 0

goroutine 1 [running]:
github.com/fleetdm/fleet/v4/server/datastore/mysql.decrypt({0x10a951f60, 0x0, 0x0}, {0x14000046069?, 0x10432eda0?})
    /Users/reed/Documents/Code/fleet/server/datastore/mysql/apple_mdm.go:4527 +0x1e0
github.com/fleetdm/fleet/v4/server/datastore/mysql.(*Datastore).GetAllMDMConfigAssetsByName(0x1400021c780, {0x1048508e0, 0x10a951f60}, {0x14000b54620, 0x1, 0x1})
    /Users/reed/Documents/Code/fleet/server/datastore/mysql/apple_mdm.go:4578 +0x2f0
github.com/fleetdm/fleet/v4/server/datastore/cached_mysql.(*cachedMysql).GetAllMDMConfigAssetsByName(0x140000a88a0, {0x1048508e0, 0x10a951f60}, {0x14000b54520, 0x1, 0x14000700008?})
    /Users/reed/Documents/Code/fleet/server/datastore/cached_mysql/cached_mysql.go:437 +0x3d0
main.createServeCmd.func1.1({0x14000b54520?, 0x103a239a6?, 0x104835ab8?})
    /Users/reed/Documents/Code/fleet/cmd/fleet/serve.go:589 +0x54
main.createServeCmd.func1(0x1400069f508, {0x103a1db09?, 0x4?, 0x103a1db0d?})
    /Users/reed/Documents/Code/fleet/cmd/fleet/serve.go:1005 +0x62ec
github.com/spf13/cobra.(*Command).execute(0x1400069f508, {0x140007ae0a0, 0x5, 0x5})
    /Users/reed/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0x828
github.com/spf13/cobra.(*Command).ExecuteC(0x1400069ec08)
    /Users/reed/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
    /Users/reed/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
    /Users/reed/Documents/Code/fleet/cmd/fleet/main.go:64 +0x428
xpkoala commented 2 months ago

This appears to have been caused by some database manipulation I had done during testing. The fix was to run DELETE from mdm_config_assets; on the database and restart the server.

Closing for now.

fleet-release commented 2 months ago

Panic fixed, all's calm, Code runs like a soothing balm, Fleet sails on, no qualm.