[GH-ISSUE #3994] QUIC Working but TCP Not Working: connect to server error: session shutdown #3169

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

Originally created by @clarkmcc on GitHub (Feb 15, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/3994

Bug Description

I'm trying to use frp as a library and have been using it for several years in production, however I've just recently upgraded from 0.3x to 0.54.0 and can't seem to get TCP working again. I get the following errors

2024/02/15 10:57:38 [I] [service.go:287] try to connect to server...
2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown

If I change the client to connect via quic, then it works just fine. This error appears to be coming from yamux. Is there some configuration that I'm missing?

frpc Version

v0.54.0

frps Version

v0.54.0

System Architecture

darwin/arm64

Configurations

Server

package main

import (
	"context"
	v1 "github.com/fatedier/frp/pkg/config/v1"
	"github.com/fatedier/frp/server"
)

func main() {
	svc, err := server.NewService(&v1.ServerConfig{
		APIMetadata: v1.APIMetadata{
			Version: "1",
		},
		Auth: v1.AuthServerConfig{
			Method: "token",
			Token:  "abc",
		},
		BindAddr:      "0.0.0.0",
		BindPort:      7010,
		VhostHTTPPort: 7011,
		QUICBindPort:  7012,
	})
	if err != nil {
		panic(err)
	}

	svc.Run(context.Background())
}

Client

package main

import (
	"context"
	"github.com/fatedier/frp/client"
	v1 "github.com/fatedier/frp/pkg/config/v1"
)

func main() {
	svc, err := client.NewService(client.ServiceOptions{
		Common: &v1.ClientCommonConfig{
			APIMetadata: v1.APIMetadata{
				Version: "1",
			},
			Auth: v1.AuthClientConfig{
				Method: "token",
				Token:  "abc",
			},
			ServerAddr: "127.0.0.1",
			ServerPort: 7010,
			Transport: v1.ClientTransportConfig{
				Protocol: "tcp",
			},
		},
		ProxyCfgs:        []v1.ProxyConfigurer{},
		VisitorCfgs:      nil,
		ConfigFilePath:   "",
		ClientSpec:       nil,
		ConnectorCreator: nil,
		HandleWorkConnCb: nil,
	})
	if err != nil {
		panic(err)
	}

	err = svc.Run(context.Background())
	if err != nil {
		panic(err)
	}
}

Logs

2024/02/15 10:57:38 [I] [service.go:287] try to connect to server...
2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown

Steps to reproduce

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @clarkmcc on GitHub (Feb 15, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/3994 ### Bug Description I'm trying to use frp as a library and have been using it for several years in production, however I've just recently upgraded from 0.3x to 0.54.0 and can't seem to get TCP working again. I get the following errors ``` 2024/02/15 10:57:38 [I] [service.go:287] try to connect to server... 2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown ``` If I change the client to connect via quic, then it works just fine. This error appears to be coming from yamux. Is there some configuration that I'm missing? ### frpc Version v0.54.0 ### frps Version v0.54.0 ### System Architecture darwin/arm64 ### Configurations # Server ```go package main import ( "context" v1 "github.com/fatedier/frp/pkg/config/v1" "github.com/fatedier/frp/server" ) func main() { svc, err := server.NewService(&v1.ServerConfig{ APIMetadata: v1.APIMetadata{ Version: "1", }, Auth: v1.AuthServerConfig{ Method: "token", Token: "abc", }, BindAddr: "0.0.0.0", BindPort: 7010, VhostHTTPPort: 7011, QUICBindPort: 7012, }) if err != nil { panic(err) } svc.Run(context.Background()) } ``` # Client ```go package main import ( "context" "github.com/fatedier/frp/client" v1 "github.com/fatedier/frp/pkg/config/v1" ) func main() { svc, err := client.NewService(client.ServiceOptions{ Common: &v1.ClientCommonConfig{ APIMetadata: v1.APIMetadata{ Version: "1", }, Auth: v1.AuthClientConfig{ Method: "token", Token: "abc", }, ServerAddr: "127.0.0.1", ServerPort: 7010, Transport: v1.ClientTransportConfig{ Protocol: "tcp", }, }, ProxyCfgs: []v1.ProxyConfigurer{}, VisitorCfgs: nil, ConfigFilePath: "", ClientSpec: nil, ConnectorCreator: nil, HandleWorkConnCb: nil, }) if err != nil { panic(err) } err = svc.Run(context.Background()) if err != nil { panic(err) } } ``` ### Logs 2024/02/15 10:57:38 [I] [service.go:287] try to connect to server... 2024/02/15 10:57:38 [W] [service.go:290] connect to server error: session shutdown ### Steps to reproduce _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [X] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@clarkmcc commented on GitHub (Feb 15, 2024):

Apparently I needed to call .Complete() on my cfg before using it.

cfg := &v1.ClientCommonConfig{
	ServerAddr: "127.0.0.1",
	ServerPort: 7010,
	Transport: v1.ClientTransportConfig{
		Protocol: "tcp",
	},
}
cfg.Complete()
<!-- gh-comment-id:1946854847 --> @clarkmcc commented on GitHub (Feb 15, 2024): Apparently I needed to call `.Complete()` on my cfg before using it. ```go cfg := &v1.ClientCommonConfig{ ServerAddr: "127.0.0.1", ServerPort: 7010, Transport: v1.ClientTransportConfig{ Protocol: "tcp", }, } cfg.Complete() ```
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#3169
No description provided.