Skip to content

当没有设置 APMPLUS_APP_KEY 时,服务启动 panic #109

@Zerofisher

Description

@Zerofisher

Describe the bug

在未设置 APMPLUS_APP_KEY 环境变量时,deer-go 应用程序在服务器初始化期间于 main.go:73 发生崩溃,并出现 panic(运行时错误:无效的内存地址或 nil 指针解引用)。

To Reproduce

Steps to reproduce the behavior:

  1. cd flow/agent/deer-go/
  2. cp ./conf/deer-go.yaml.1 ./conf/deer-go.yaml
  3. cd biz/mcps/python && uv sync
  4. ./run.sh -s
  5. See panic error

Expected behavior

即使未设置 APMPLUS_APP_KEY,应用程序也应成功启动,并在没有 APMPlus 跟踪功能的情况下运行。

Screenshots

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf72d48d]

goroutine 1 [running]:
github.com/cloudwego/hertz/pkg/common/config.(*Options).Apply(...)
/Users/lesion/go/pkg/mod/github.com/cloudwego/hertz@v0.10.0/pkg/common/config/option.go:127
github.com/cloudwego/hertz/pkg/common/config.NewOptions({0xc000125f18, 0x2, 0xf?})
/Users/lesion/go/pkg/mod/github.com/cloudwego/hertz@v0.10.0/pkg/common/config/option.go:264 +0x18d
github.com/cloudwego/hertz/pkg/app/server.New({0xc000125f18?, 0xc0004632c0?, 0xff22980?})
/Users/lesion/go/pkg/mod/github.com/cloudwego/hertz@v0.10.0/pkg/app/server/hertz.go:40 +0x18
github.com/cloudwego/hertz/pkg/app/server.Default({0xc000125f18?, 0x10b37600?, 0xf074801?})
/Users/lesion/go/pkg/mod/github.com/cloudwego/hertz@v0.10.0/pkg/app/server/hertz.go:49 +0x18
main.runServer()
/Users/lesion/code/go/eino-examples/flow/agent/deer-go/main.go:73 +0x150
main.main()
/Users/lesion/code/go/eino-examples/flow/agent/deer-go/main.go:138 +0x32

Version:

Latest commit: a0e96f1 (refactor: migration from OpenAPIV3 to JSONSchema)

Environment:

GOVERSION='go1.23.12'
GOOS='darwin'
GOARCH='amd64'

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions