[GH-ISSUE #5082] frpc deadlocking in certain scenarios #3992

Closed
opened 2026-05-05 14:32:19 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @singlatushar07 on GitHub (Dec 1, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/5082

Bug Description

So this happens when tcp connection closes. Currently we construct message transporter using transport.NewMessageTransporter(ctl.msgDispatcher.SendChannel())

And directly call Send(). If the Handler has stopped due to dropped TCP connection we still try to write to same channel while holding the lock as shown in stacktrace and eventually get stuck here.

frpc Version

0.65

frps Version

0.65

System Architecture

linux/x86

Configurations

..

Logs

stack trace:
goroutine 82 gp=0xc00038ac40 m=nil [chan send, 5069 minutes]:
runtime.gopark(0x12c2420?, 0xc000925f80?, 0x10?, 0x0?, 0x10?)
        runtime/proc.go:424 +0xce fp=0xc000325d18 sp=0xc000325cf8 pc=0x473f0e
runtime.chansend(0xc00047e000, 0xc000325e30, 0x1, 0x75c6ac072f98?)
        runtime/chan.go:270 +0x38d fp=0xc000325d88 sp=0xc000325d18 pc=0x408d4d
runtime.chansend1(0x0?, 0xc000325de0?)
        runtime/chan.go:156 +0x17 fp=0xc000325db8 sp=0xc000325d88 pc=0x4089b7
github.com/fatedier/frp/pkg/transport.(*transporterImpl).Send.func1()
        github.com/fatedier/frp/pkg/transport/message.go:57 +0x1e fp=0xc000325dd8 sp=0xc000325db8 pc=0x9ef07e
github.com/fatedier/golib/errors.PanicToError(0x40f290?)
        github.com/fatedier/golib@v0.5.1/errors/errors.go:28 +0x4d fp=0xc000325e18 sp=0xc000325dd8 pc=0x9e7d2d
github.com/fatedier/frp/pkg/transport.(*transporterImpl).Send(0x0?, {0xb06d80?, 0xc000925250?})
        github.com/fatedier/frp/pkg/transport/message.go:56 +0x3d fp=0xc000325e50 sp=0xc000325e18 pc=0x9ef01d
github.com/fatedier/frp/client/proxy.(*Manager).HandleEvent(0x10?, {0xb0bdc0?, 0xc00046e350?})
        github.com/fatedier/frp/client/proxy/proxy_manager.go:114 +0x7a fp=0xc000325e78 sp=0xc000325e50 pc=0xa9643a
github.com/fatedier/frp/client/proxy.(*Manager).HandleEvent-fm({0xb0bdc0?, 0xc00046e350?})
        <autogenerated>:1 +0x33 fp=0xc000325ea0 sp=0xc000325e78 pc=0xa9fc73
github.com/fatedier/frp/client/proxy.(*Wrapper).close(...)
        github.com/fatedier/frp/client/proxy/proxy_wrapper.go:182
github.com/fatedier/frp/client/proxy.(*Wrapper).Stop(0xc0002dd0e0)
        github.com/fatedier/frp/client/proxy/proxy_wrapper.go:178 +0x151 fp=0xc000325ef0 sp=0xc000325ea0 pc=0xa97d51
github.com/fatedier/frp/client/proxy.(*Manager).Close(0xc00045a2a0)
        github.com/fatedier/frp/client/proxy/proxy_manager.go:87 +0xb9 fp=0xc000325fa0 sp=0xc000325ef0 pc=0xa96199
github.com/fatedier/frp/client.(*Control).worker(0xc00045a0c0)
        github.com/fatedier/frp/client/control.go:285 +0xd3 fp=0xc000325fc8 sp=0xc000325fa0 pc=0xab8233
github.com/fatedier/frp/client.(*Control).Run.gowrap1()
        github.com/fatedier/frp/client/control.go:112 +0x25 fp=0xc000325fe0 sp=0xc000325fc8 pc=0xab68e5
runtime.goexit({})
        runtime/asm_amd64.s:1700 +0x1 fp=0xc000325fe8 sp=0xc000325fe0 pc=0x47bec1
created by github.com/fatedier/frp/client.(*Control).Run in goroutine 1
        github.com/fatedier/frp/client/control.go:112 +0x76

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @singlatushar07 on GitHub (Dec 1, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/5082 ### Bug Description So this happens when tcp connection closes. Currently we construct message transporter using transport.NewMessageTransporter(ctl.msgDispatcher.SendChannel()) And directly call Send(). If the Handler has stopped due to dropped TCP connection we still try to write to same channel while holding the lock as shown in stacktrace and eventually get stuck here. ### frpc Version 0.65 ### frps Version 0.65 ### System Architecture linux/x86 ### Configurations .. ### Logs ``` stack trace: goroutine 82 gp=0xc00038ac40 m=nil [chan send, 5069 minutes]: runtime.gopark(0x12c2420?, 0xc000925f80?, 0x10?, 0x0?, 0x10?) runtime/proc.go:424 +0xce fp=0xc000325d18 sp=0xc000325cf8 pc=0x473f0e runtime.chansend(0xc00047e000, 0xc000325e30, 0x1, 0x75c6ac072f98?) runtime/chan.go:270 +0x38d fp=0xc000325d88 sp=0xc000325d18 pc=0x408d4d runtime.chansend1(0x0?, 0xc000325de0?) runtime/chan.go:156 +0x17 fp=0xc000325db8 sp=0xc000325d88 pc=0x4089b7 github.com/fatedier/frp/pkg/transport.(*transporterImpl).Send.func1() github.com/fatedier/frp/pkg/transport/message.go:57 +0x1e fp=0xc000325dd8 sp=0xc000325db8 pc=0x9ef07e github.com/fatedier/golib/errors.PanicToError(0x40f290?) github.com/fatedier/golib@v0.5.1/errors/errors.go:28 +0x4d fp=0xc000325e18 sp=0xc000325dd8 pc=0x9e7d2d github.com/fatedier/frp/pkg/transport.(*transporterImpl).Send(0x0?, {0xb06d80?, 0xc000925250?}) github.com/fatedier/frp/pkg/transport/message.go:56 +0x3d fp=0xc000325e50 sp=0xc000325e18 pc=0x9ef01d github.com/fatedier/frp/client/proxy.(*Manager).HandleEvent(0x10?, {0xb0bdc0?, 0xc00046e350?}) github.com/fatedier/frp/client/proxy/proxy_manager.go:114 +0x7a fp=0xc000325e78 sp=0xc000325e50 pc=0xa9643a github.com/fatedier/frp/client/proxy.(*Manager).HandleEvent-fm({0xb0bdc0?, 0xc00046e350?}) <autogenerated>:1 +0x33 fp=0xc000325ea0 sp=0xc000325e78 pc=0xa9fc73 github.com/fatedier/frp/client/proxy.(*Wrapper).close(...) github.com/fatedier/frp/client/proxy/proxy_wrapper.go:182 github.com/fatedier/frp/client/proxy.(*Wrapper).Stop(0xc0002dd0e0) github.com/fatedier/frp/client/proxy/proxy_wrapper.go:178 +0x151 fp=0xc000325ef0 sp=0xc000325ea0 pc=0xa97d51 github.com/fatedier/frp/client/proxy.(*Manager).Close(0xc00045a2a0) github.com/fatedier/frp/client/proxy/proxy_manager.go:87 +0xb9 fp=0xc000325fa0 sp=0xc000325ef0 pc=0xa96199 github.com/fatedier/frp/client.(*Control).worker(0xc00045a0c0) github.com/fatedier/frp/client/control.go:285 +0xd3 fp=0xc000325fc8 sp=0xc000325fa0 pc=0xab8233 github.com/fatedier/frp/client.(*Control).Run.gowrap1() github.com/fatedier/frp/client/control.go:112 +0x25 fp=0xc000325fe0 sp=0xc000325fc8 pc=0xab68e5 runtime.goexit({}) runtime/asm_amd64.s:1700 +0x1 fp=0xc000325fe8 sp=0xc000325fe0 pc=0x47bec1 created by github.com/fatedier/frp/client.(*Control).Run in goroutine 1 github.com/fatedier/frp/client/control.go:112 +0x76 ``` ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [x] Performance and Scalability - [ ] Security - [x] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:32:19 -06:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@fatedier commented on GitHub (Dec 2, 2025):

What was the first error message?

<!-- gh-comment-id:3599842380 --> @fatedier commented on GitHub (Dec 2, 2025): What was the first error message?
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#3992
No description provided.