[GH-ISSUE #1841] 从0.32.x ~ 0.33.0开始RegisterControl错误 #1455

Closed
opened 2026-05-05 12:55:19 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @longkeyy on GitHub (Jun 4, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/1841

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
0.32.x ~ 0.33.0
What operating system and processor architecture are you using (go env)?

GO111MODULE=""
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"

Configures you used:
bindPort=443
bindUdpPort=443
kcpBindPort=0

[common]
server_addr = 127.0.0.1
server_port = 443
token = 123456

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 50000

Steps to reproduce the issue:
1.
2.
3.

Describe the results you received:
./frpc -c frpc.ini
2020/06/04 17:28:40 [W] [service.go:101] login to server failed: EOF

Describe the results you expected:
----------------------------------------v0.33.0------------------------------------------------
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1512950]

goroutine 24 [running]:
github.com/fatedier/frp/server.(*Service).RegisterControl(0xc0000c18c0, 0x188de00, 0xc0001160c0, 0xc0000c4240, 0x0, 0x0)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:442 +0x440
github.com/fatedier/frp/server.(*Service).handleConnection(0xc0000c18c0, 0x1887f80, 0xc000028118, 0x188de00, 0xc0001160c0)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:328 +0xaa4
created by github.com/fatedier/frp/server.(*Service).HandleListener.func1
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:409 +0x22d

----------------------------------------v0.32.1------------------------------------------------

2020/06/04 17:37:20 [I] [service.go:157] frps tcp listen on 0.0.0.0:443
2020/06/04 17:37:20 [I] [service.go:255] nat hole udp service listen on 0.0.0.0:443
2020/06/04 17:37:20 [I] [service.go:273] Dashboard listen on 0.0.0.0:81
2020/06/04 17:37:20 [I] [dashboard_service.go:80] Start success
2020/06/04 17:37:24 [I] [service.go:420] [d612a0e7684f908b] client login info: ip [127.0.0.1:57437] version [0.33.0] hostname [] os [darwin] arch [amd64]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x150dc60]

goroutine 13 [running]:
github.com/fatedier/frp/server.(*Service).RegisterControl(0xc0001386c0, 0x18880e0, 0xc00014e000, 0xc00017c090, 0x0, 0x0)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:430 +0x440
github.com/fatedier/frp/server.(*Service).HandleListener.func1.1(0x18880e0, 0xc00014e000)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:342 +0xae2
created by github.com/fatedier/frp/server.(*Service).HandleListener.func1
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:397 +0x265

----------------------------------------v0.32.0------------------------------------------------

2020/06/04 17:35:03 [I] [service.go:157] frps tcp listen on 0.0.0.0:443
2020/06/04 17:35:03 [I] [service.go:255] nat hole udp service listen on 0.0.0.0:443
2020/06/04 17:35:03 [I] [service.go:273] Dashboard listen on 0.0.0.0:81
2020/06/04 17:35:03 [I] [dashboard_service.go:80] Start success
2020/06/04 17:35:13 [I] [service.go:420] [76012cb0a235c5ee] client login info: ip [127.0.0.1:56648] version [0.33.0] hostname [] os [darwin] arch [amd64]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x150c570]

goroutine 66 [running]:
github.com/fatedier/frp/server.(*Service).RegisterControl(0xc00042a480, 0x1885f00, 0xc00013e0c0, 0xc0000d6510, 0x0, 0x0)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:430 +0x440
github.com/fatedier/frp/server.(*Service).HandleListener.func1.1(0x1885f00, 0xc00013e0c0)
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:342 +0xae2
created by github.com/fatedier/frp/server.(*Service).HandleListener.func1
/Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:397 +0x265

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @longkeyy on GitHub (Jun 4, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/1841 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** 0.32.x ~ 0.33.0 **What operating system and processor architecture are you using (`go env`)?** GO111MODULE="" GOARCH="amd64" GOHOSTARCH="amd64" GOHOSTOS="darwin" **Configures you used:** bindPort=443 bindUdpPort=443 kcpBindPort=0 [common] server_addr = 127.0.0.1 server_port = 443 token = 123456 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 50000 **Steps to reproduce the issue:** 1. 2. 3. **Describe the results you received:** ./frpc -c frpc.ini 2020/06/04 17:28:40 [W] [service.go:101] login to server failed: EOF **Describe the results you expected:** ----------------------------------------v0.33.0------------------------------------------------ panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1512950] goroutine 24 [running]: github.com/fatedier/frp/server.(*Service).RegisterControl(0xc0000c18c0, 0x188de00, 0xc0001160c0, 0xc0000c4240, 0x0, 0x0) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:442 +0x440 github.com/fatedier/frp/server.(*Service).handleConnection(0xc0000c18c0, 0x1887f80, 0xc000028118, 0x188de00, 0xc0001160c0) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:328 +0xaa4 created by github.com/fatedier/frp/server.(*Service).HandleListener.func1 /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.33.0/server/service.go:409 +0x22d ----------------------------------------v0.32.1------------------------------------------------ 2020/06/04 17:37:20 [I] [service.go:157] frps tcp listen on 0.0.0.0:443 2020/06/04 17:37:20 [I] [service.go:255] nat hole udp service listen on 0.0.0.0:443 2020/06/04 17:37:20 [I] [service.go:273] Dashboard listen on 0.0.0.0:81 2020/06/04 17:37:20 [I] [dashboard_service.go:80] Start success 2020/06/04 17:37:24 [I] [service.go:420] [d612a0e7684f908b] client login info: ip [127.0.0.1:57437] version [0.33.0] hostname [] os [darwin] arch [amd64] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x150dc60] goroutine 13 [running]: github.com/fatedier/frp/server.(*Service).RegisterControl(0xc0001386c0, 0x18880e0, 0xc00014e000, 0xc00017c090, 0x0, 0x0) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:430 +0x440 github.com/fatedier/frp/server.(*Service).HandleListener.func1.1(0x18880e0, 0xc00014e000) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:342 +0xae2 created by github.com/fatedier/frp/server.(*Service).HandleListener.func1 /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.1/server/service.go:397 +0x265 ----------------------------------------v0.32.0------------------------------------------------ 2020/06/04 17:35:03 [I] [service.go:157] frps tcp listen on 0.0.0.0:443 2020/06/04 17:35:03 [I] [service.go:255] nat hole udp service listen on 0.0.0.0:443 2020/06/04 17:35:03 [I] [service.go:273] Dashboard listen on 0.0.0.0:81 2020/06/04 17:35:03 [I] [dashboard_service.go:80] Start success 2020/06/04 17:35:13 [I] [service.go:420] [76012cb0a235c5ee] client login info: ip [127.0.0.1:56648] version [0.33.0] hostname [] os [darwin] arch [amd64] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x150c570] goroutine 66 [running]: github.com/fatedier/frp/server.(*Service).RegisterControl(0xc00042a480, 0x1885f00, 0xc00013e0c0, 0xc0000d6510, 0x0, 0x0) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:430 +0x440 github.com/fatedier/frp/server.(*Service).HandleListener.func1.1(0x1885f00, 0xc00013e0c0) /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:342 +0xae2 created by github.com/fatedier/frp/server.(*Service).HandleListener.func1 /Users/longkeyy/go/pkg/mod/github.com/fatedier/frp@v0.32.0/server/service.go:397 +0x265 **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@longkeyy commented on GitHub (Jun 4, 2020):

unc GetDefaultServerConf() config.ServerCommonConf {
return config.ServerCommonConf{
BindAddr: "0.0.0.0",
BindPort: 7000,
BindUdpPort: 0,
KcpBindPort: 0,
ProxyBindAddr: "0.0.0.0",
VhostHttpPort: 0,
VhostHttpsPort: 0,
TcpMuxHttpConnectPort: 0,
VhostHttpTimeout: 60,
DashboardAddr: "0.0.0.0",
DashboardPort: 0,
DashboardUser: "admin",
DashboardPwd: "admin",
EnablePrometheus: false,
AssetsDir: "",
LogFile: "console",
LogWay: "console",
LogLevel: "info",
LogMaxDays: 3,
DisableLogColor: false,
DetailedErrorsToClient: true,
SubDomainHost: "",
TcpMux: true,
AllowPorts: make(map[int]struct{}),
MaxPoolCount: 5,
MaxPortsPerClient: 0,
TlsOnly: false,
HeartBeatTimeout: 90,
UserConnTimeout: 10,
Custom404Page: "",
HTTPPlugins: make(map[string]plugin.HTTPPluginOptions),
AuthServerConfig: auth.GetDefaultAuthServerConf(),
}
}

建议增加
AuthServerConfig: auth.GetDefaultAuthServerConf(),

<!-- gh-comment-id:638806208 --> @longkeyy commented on GitHub (Jun 4, 2020): unc GetDefaultServerConf() config.ServerCommonConf { return config.ServerCommonConf{ BindAddr: "0.0.0.0", BindPort: 7000, BindUdpPort: 0, KcpBindPort: 0, ProxyBindAddr: "0.0.0.0", VhostHttpPort: 0, VhostHttpsPort: 0, TcpMuxHttpConnectPort: 0, VhostHttpTimeout: 60, DashboardAddr: "0.0.0.0", DashboardPort: 0, DashboardUser: "admin", DashboardPwd: "admin", EnablePrometheus: false, AssetsDir: "", LogFile: "console", LogWay: "console", LogLevel: "info", LogMaxDays: 3, DisableLogColor: false, DetailedErrorsToClient: true, SubDomainHost: "", TcpMux: true, AllowPorts: make(map[int]struct{}), MaxPoolCount: 5, MaxPortsPerClient: 0, TlsOnly: false, HeartBeatTimeout: 90, UserConnTimeout: 10, Custom404Page: "", HTTPPlugins: make(map[string]plugin.HTTPPluginOptions), AuthServerConfig: auth.GetDefaultAuthServerConf(), } } 建议增加 AuthServerConfig: auth.GetDefaultAuthServerConf(),
Author
Owner

@fatedier commented on GitHub (Jun 4, 2020):

看了下在 UnmarshalServerConfFromIni 里有配置默认值,怎么复现你遇到的问题?

<!-- gh-comment-id:638853455 --> @fatedier commented on GitHub (Jun 4, 2020): 看了下在 `UnmarshalServerConfFromIni` 里有配置默认值,怎么复现你遇到的问题?
Author
Owner

@longkeyy commented on GitHub (Jun 5, 2020):

我自己写了一个启动器,之前都是调用GetDefaultServerConf() 来初始化配置,然后再修改个性配置。

<!-- gh-comment-id:639293086 --> @longkeyy commented on GitHub (Jun 5, 2020): 我自己写了一个启动器,之前都是调用GetDefaultServerConf() 来初始化配置,然后再修改个性配置。
Author
Owner

@fatedier commented on GitHub (Jun 5, 2020):

OK,你可以提个 PR 把这个加在 GetDefaultServerConf() 里。

不过正在重构代码,这部分后面可能也会改动比较大。

<!-- gh-comment-id:639294409 --> @fatedier commented on GitHub (Jun 5, 2020): OK,你可以提个 PR 把这个加在 GetDefaultServerConf() 里。 不过正在重构代码,这部分后面可能也会改动比较大。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1455
No description provided.