[GH-ISSUE #5038] Unable to connect to stcp client #3966

Closed
opened 2026-05-05 14:31:21 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @smac89 on GitHub (Oct 31, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/5038

Bug Description

I have the following stcp proxy running on a remote client (A):

[[proxies]]
name = "python_server"
type = "stcp"
secretKey = "asbsad"
localIP = "127.0.0.1"
localPort = 8000

On my machine (B), I have frpc configured with the following:

[[visitors]]
name = "python_server_visitor"
type = "stcp"
serverName = "python_server"
secretKey = "asbsad"
bindAddr = "127.0.0.1"
bindPort = 8080

When I start frpc on (A), I see:

Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml]
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:325] try to connect to server...
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:204] admin server listen on 127.7.7.7:8800
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.038 [I] [client/service.go:317] [0b09b040b632fd6a] login to server success, get run id [0b09b040b632fd6a]
Oct 30 23:29:43 server frpc[718553]: 2025-10-30 23:29:43.040 [I] [client/control.go:172] [0b09b040b632fd6a] [A.python_server] start proxy success

When I start frpc on (B), I see the following output:

Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml]
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [client/service.go:325] try to connect to server...
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.334 [I] [client/service.go:317] [22cfa6cfc23562db] login to server success, get run id [22cfa6cfc23562db]
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:128] [22cfa6cfc23562db] start visitor success
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:179] [22cfa6cfc23562db] visitor added: [B.python_server_visitor]

Now on (B), I run the command:

curl -vv http://127.0.0.1:8080

And it fails. See the output in the logs.

At the same time, this is the new output of frpc running on (B):

Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.282 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection
Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.387 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist
Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.073 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection
Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.105 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist

The output of (A) hasn't changed. The server running on (A) is just:

python -m http.server -b 127.0.0.1 -d . 8000

frpc Version

0.65.0

frps Version

0.65.0

System Architecture

linux/amd64

Configurations

// [Client A]

[[proxies]]
name = "python_server"
type = "stcp"
secretKey = "asbsad"
localIP = "127.0.0.1"
localPort = 8000

// [Client B]

[[visitors]]
name = "python_server_visitor"
type = "stcp"
serverName = "python_server"
secretKey = "asbsad"
bindAddr = "127.0.0.1"
bindPort = 8080

Logs

// [Curl output]

23:48:11.072858 [0-0] * [SETUP] added
23:48:11.072978 [0-0] * Trying 127.0.0.1:8080...
23:48:11.073127 [0-0] * [SETUP] Curl_conn_connect(block=0) -> 0, done=0
23:48:11.073231 [0-0] * [SETUP] Curl_conn_connect(block=0) -> 0, done=1
23:48:11.073289 [0-0] * Established connection to 127.0.0.1 (127.0.0.1 port 8080) from 127.0.0.1 port 58380
23:48:11.073403 [0-0] * [SETUP] query ALPN
23:48:11.073500 [0-0] * using HTTP/1.x
23:48:11.073671 [0-0] > GET / HTTP/1.1
23:48:11.073671 [0-0] > Host: 127.0.0.1:8080
23:48:11.073671 [0-0] > User-Agent: curl/8.16.0
23:48:11.073671 [0-0] > Accept: /
23:48:11.073671 [0-0] >
23:48:11.073928 [0-0] * Request completely sent off
23:48:11.106165 [0-0] * Recv failure: Connection reset by peer
23:48:11.106265 [0-0] * closing connection #0
curl: (56) Recv failure: Connection reset by peer

// [Client A logs]

Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml]
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:325] try to connect to server...
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:204] admin server listen on 127.7.7.7:8800
Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.038 [I] [client/service.go:317] [0b09b040b632fd6a] login to server success, get run id [0b09b040b632fd6a]
Oct 30 23:29:43 server frpc[718553]: 2025-10-30 23:29:43.040 [I] [client/control.go:172] [0b09b040b632fd6a] [A.python_server] start proxy success

// [Client B logs]

Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml]
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [client/service.go:325] try to connect to server...
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.334 [I] [client/service.go:317] [22cfa6cfc23562db] login to server success, get run id [22cfa6cfc23562db]
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:128] [22cfa6cfc23562db] start visitor success
Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:179] [22cfa6cfc23562db] visitor added: [B.python_server_visitor]
Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.282 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection
Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.387 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist
Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.073 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection
Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.105 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist

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 @smac89 on GitHub (Oct 31, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/5038 ### Bug Description I have the following stcp proxy running on a remote client (A): ```toml [[proxies]] name = "python_server" type = "stcp" secretKey = "asbsad" localIP = "127.0.0.1" localPort = 8000 ``` On my machine (B), I have frpc configured with the following: ```toml [[visitors]] name = "python_server_visitor" type = "stcp" serverName = "python_server" secretKey = "asbsad" bindAddr = "127.0.0.1" bindPort = 8080 ``` When I start frpc on (A), I see: > Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml] Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:325] try to connect to server... Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:204] admin server listen on 127.7.7.7:8800 Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.038 [I] [client/service.go:317] [0b09b040b632fd6a] login to server success, get run id [0b09b040b632fd6a] Oct 30 23:29:43 server frpc[718553]: 2025-10-30 23:29:43.040 [I] [client/control.go:172] [0b09b040b632fd6a] [A.python_server] start proxy success When I start frpc on (B), I see the following output: > Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml] Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [client/service.go:325] try to connect to server... Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.334 [I] [client/service.go:317] [22cfa6cfc23562db] login to server success, get run id [22cfa6cfc23562db] Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:128] [22cfa6cfc23562db] start visitor success Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:179] [22cfa6cfc23562db] visitor added: [B.python_server_visitor] Now on (B), I run the command: ``` curl -vv http://127.0.0.1:8080 ``` And it fails. See the output in the logs. At the same time, this is the new output of frpc running on (B): > Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.282 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.387 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.073 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.105 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist The output of (A) hasn't changed. The server running on (A) is just: ```sh python -m http.server -b 127.0.0.1 -d . 8000 ``` ### frpc Version 0.65.0 ### frps Version 0.65.0 ### System Architecture linux/amd64 ### Configurations // [Client A] ```toml [[proxies]] name = "python_server" type = "stcp" secretKey = "asbsad" localIP = "127.0.0.1" localPort = 8000 ``` // [Client B] ```toml [[visitors]] name = "python_server_visitor" type = "stcp" serverName = "python_server" secretKey = "asbsad" bindAddr = "127.0.0.1" bindPort = 8080 ``` ### Logs // [Curl output] > 23:48:11.072858 [0-0] * [SETUP] added 23:48:11.072978 [0-0] * Trying 127.0.0.1:8080... 23:48:11.073127 [0-0] * [SETUP] Curl_conn_connect(block=0) -> 0, done=0 23:48:11.073231 [0-0] * [SETUP] Curl_conn_connect(block=0) -> 0, done=1 23:48:11.073289 [0-0] * Established connection to 127.0.0.1 (127.0.0.1 port 8080) from 127.0.0.1 port 58380 23:48:11.073403 [0-0] * [SETUP] query ALPN 23:48:11.073500 [0-0] * using HTTP/1.x 23:48:11.073671 [0-0] > GET / HTTP/1.1 23:48:11.073671 [0-0] > Host: 127.0.0.1:8080 23:48:11.073671 [0-0] > User-Agent: curl/8.16.0 23:48:11.073671 [0-0] > Accept: */* 23:48:11.073671 [0-0] > 23:48:11.073928 [0-0] * Request completely sent off 23:48:11.106165 [0-0] * Recv failure: Connection reset by peer 23:48:11.106265 [0-0] * closing connection #0 curl: (56) Recv failure: Connection reset by peer // [Client A logs] > Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml] Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:325] try to connect to server... Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.032 [I] [client/service.go:204] admin server listen on 127.7.7.7:8800 Oct 30 23:29:43 servegod2 frpc[718553]: 2025-10-30 23:29:43.038 [I] [client/service.go:317] [0b09b040b632fd6a] login to server success, get run id [0b09b040b632fd6a] Oct 30 23:29:43 server frpc[718553]: 2025-10-30 23:29:43.040 [I] [client/control.go:172] [0b09b040b632fd6a] [A.python_server] start proxy success // [Client B logs] > Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [sub/root.go:149] start frpc service for config file [/run/credentials/frpc.service/config_toml] Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.195 [I] [client/service.go:325] try to connect to server... Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.334 [I] [client/service.go:317] [22cfa6cfc23562db] login to server success, get run id [22cfa6cfc23562db] Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:128] [22cfa6cfc23562db] start visitor success Oct 30 23:47:14 archpc frpc[43483]: 2025-10-30 23:47:14.342 [I] [visitor/visitor_manager.go:179] [22cfa6cfc23562db] visitor added: [B.python_server_visitor] Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.282 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection Oct 30 23:48:07 archpc frpc[43483]: 2025-10-30 23:48:07.387 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.073 [D] [visitor/stcp.go:86] [22cfa6cfc23562db] [B.python_server_visitor] get a new stcp user connection Oct 30 23:48:11 archpc frpc[43483]: 2025-10-30 23:48:11.105 [W] [visitor/stcp.go:118] [22cfa6cfc23562db] [B.python_server_visitor] start new visitor connection error: custom listener for [B.python_server] doesn't exist ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [x] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [x] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:31:21 -06:00
Author
Owner

@fatedier commented on GitHub (Oct 31, 2025):

Not an STCP bug—this is a namespace mismatch caused by different user values.
Your STCP listener is registered as [A.python_server] (because the client on the server side uses user = A), but the visitor is trying to connect to [B.python_server]. When serverUser is not set on the visitor, it defaults to the visitor’s local user (i.e., B), so FRP can’t find the listener and prints: custom listener for [B.python_server] doesn't exist.

Fix (pick one)

  1. Set serverUser on the visitor to point at A

    [[visitors]]
    name = "python_server_visitor"
    type = "stcp"
    serverName = "python_server"
    serverUser = "A"          # <-- must match the listener's user
    secretKey = "asbsad"
    bindAddr = "127.0.0.1"
    bindPort = 8080
    
  2. Make the user the same on both sides
    Use the same user in both clients’ common config (or leave it unset on both), so the default visitor behavior resolves to the correct <user>.<proxyName>.

<!-- gh-comment-id:3471307430 --> @fatedier commented on GitHub (Oct 31, 2025): Not an STCP bug—this is a namespace mismatch caused by different user values. Your STCP listener is registered as [A.python_server] (because the client on the server side uses user = A), but the visitor is trying to connect to [B.python_server]. When serverUser is not set on the visitor, it defaults to the visitor’s local user (i.e., B), so FRP can’t find the listener and prints: custom listener for [B.python_server] doesn't exist. Fix (pick one) 1. Set serverUser on the visitor to point at A ``` [[visitors]] name = "python_server_visitor" type = "stcp" serverName = "python_server" serverUser = "A" # <-- must match the listener's user secretKey = "asbsad" bindAddr = "127.0.0.1" bindPort = 8080 ``` 2. Make the user the same on both sides Use the same user in both clients’ common config (or leave it unset on both), so the default visitor behavior resolves to the correct `<user>.<proxyName>`.
Author
Owner

@smac89 commented on GitHub (Oct 31, 2025):

@fatedier

So I tried your suggestion above using the first option of setting serverUser = "A", but this also failed to work. The new error I get is:

Oct 31 09:32:17 archpc frpc[3181]: 2025-10-31 09:32:17.626 [W] [visitor/stcp.go:118] [5a1a9c4925f5b5c9] [B.python_server_visitor] start new visitor connection error: visitor connection of [A.python_server] user [B] not allowed

So I had to go into client A and modify its configuration to look like:

[[proxies]]
name = "python_server"
type = "stcp"
secretKey = "asbsad"
localIP = "127.0.0.1"
localPort = 8000
allowUsers = ["*"] # or allowUsers = ["B"]

This was the only way to make it work.

The current configuration of B is now:

[[visitors]]
name = "python_server_visitor"
type = "stcp"
serverUser = "A"
serverName = "python_server"
secretKey = "asbsad"
bindAddr = "127.0.0.1"
bindPort = 8080

Yes it works, but seems rather redundant. If allowUsers = [...] on A is somehow supposed to control what users are allowed to connect to the client, then what is the point of also having to specify serverUser = "A" on other clients?

<!-- gh-comment-id:3473138615 --> @smac89 commented on GitHub (Oct 31, 2025): @fatedier So I tried your suggestion above using the first option of setting `serverUser = "A"`, but this also failed to work. The new error I get is: > Oct 31 09:32:17 archpc frpc[3181]: 2025-10-31 09:32:17.626 [W] [visitor/stcp.go:118] [5a1a9c4925f5b5c9] [B.python_server_visitor] start new visitor connection error: visitor connection of [A.python_server] user [B] not allowed So I had to go into client A and modify its configuration to look like: ```toml [[proxies]] name = "python_server" type = "stcp" secretKey = "asbsad" localIP = "127.0.0.1" localPort = 8000 allowUsers = ["*"] # or allowUsers = ["B"] ``` This was the only way to make it work. The current configuration of `B` is now: ```toml [[visitors]] name = "python_server_visitor" type = "stcp" serverUser = "A" serverName = "python_server" secretKey = "asbsad" bindAddr = "127.0.0.1" bindPort = 8080 ``` --- Yes it works, but seems rather redundant. If `allowUsers = [...]` on `A` is somehow supposed to control what users are allowed to connect to the client, then what is the point of also having to specify `serverUser = "A"` on other clients?
Author
Owner

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

Your STCP listener is registered as [A.python_server] , not [python_server].

<!-- gh-comment-id:3477848489 --> @fatedier commented on GitHub (Nov 2, 2025): Your STCP listener is registered as [A.python_server] , not [python_server].
Author
Owner

@smac89 commented on GitHub (Nov 3, 2025):

Your STCP listener is registered as [A.python_server] , not [python_server].

I'm not sure how to interpret this. Are you saying that what you suggested was wrong, or are you talking about another way of setting up the listener? In my last comment, I explained that your suggestion worked because I added the allowUsers field to A.

<!-- gh-comment-id:3478677722 --> @smac89 commented on GitHub (Nov 3, 2025): > Your STCP listener is registered as [A.python_server] , not [python_server]. I'm not sure how to interpret this. Are you saying that what you suggested was wrong, or are you talking about another way of setting up the listener? In my last comment, I explained that your suggestion worked because I added the `allowUsers` field to A.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 18, 2025):

Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.

<!-- gh-comment-id:3544537810 --> @github-actions[bot] commented on GitHub (Nov 18, 2025): Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d of inactivity and eventually close.
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#3966
No description provided.