Skip to content

Conversation

@enfein
Copy link

@enfein enfein commented Nov 22, 2025

Note: because UDP transport uses a single goroutine to handle all incoming packets to the same destination port, it is slow and can't survive stress test. We may fix that in the future.

@wwqgtxx wwqgtxx merged commit 5aa140c into MetaCubeX:Alpha Nov 22, 2025
119 checks passed
@enfein enfein deleted the mieru branch November 22, 2025 00:56
@ilovebamboo

This comment was marked as off-topic.

@ilovebamboo

This comment was marked as off-topic.

@MetaCubeX MetaCubeX locked as off-topic and limited conversation to collaborators Nov 23, 2025
@MetaCubeX MetaCubeX unlocked this conversation Nov 28, 2025
@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Nov 28, 2025

maybe should fix those problem, we have encountered this panic twice in CI.

eg: https://github.com/MetaCubeX/mihomo/actions/runs/19690634360/job/56405414712#step:6:922

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x95ee0]

goroutine 867 [running]:
internal/sync.(*HashTrieMap[...]).LoadAndDelete(0xe87300, {0xa71800, 0x4000d70d7c})
	/opt/hostedtoolcache/go/1.24.10/arm64/src/internal/sync/hashtriemap.go:311 +0x50
internal/sync.(*HashTrieMap[...]).Delete(...)
	/opt/hostedtoolcache/go/1.24.10/arm64/src/internal/sync/hashtriemap.go:360
sync.(*Map).Delete(...)
	/opt/hostedtoolcache/go/1.24.10/arm64/src/sync/hashtriemap.go:78
github.com/enfein/mieru/v3/pkg/protocol.(*baseUnderlay).RemoveSession(0x40009c6410, 0x40014a54a0)
	/home/runner/go/pkg/mod/github.com/enfein/mieru/[email protected]/pkg/protocol/underlay_base.go:169 +0x70
github.com/enfein/mieru/v3/pkg/protocol.(*StreamUnderlay).onCloseSession(0x40009c6410, 0x400174a300)
	/home/runner/go/pkg/mod/github.com/enfein/mieru/[email protected]/pkg/protocol/underlay_stream.go:288 +0xa0
github.com/enfein/mieru/v3/pkg/protocol.(*StreamUnderlay).RunEventLoop(0x40009c6410, {0xe61a28, 0x1c407a0})
	/home/runner/go/pkg/mod/github.com/enfein/mieru/[email protected]/pkg/protocol/underlay_stream.go:203 +0x3bc
github.com/enfein/mieru/v3/pkg/protocol.(*Mux).newUnderlay.func1()
	/home/runner/go/pkg/mod/github.com/enfein/mieru/[email protected]/pkg/protocol/mux.go:648 +0x44
created by github.com/enfein/mieru/v3/pkg/protocol.(*Mux).newUnderlay in goroutine 275
	/home/runner/go/pkg/mod/github.com/enfein/mieru/[email protected]/pkg/protocol/mux.go:646 +0x584

@enfein
Copy link
Author

enfein commented Nov 28, 2025

The test error exposes some concurrency issue under stress. I will do some analysis.

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Nov 29, 2025

Feedback indicates that the current UDP outbound traffic cannot handle cases where the server is a domain name.

I reviewed the existing client API and found that although a resolver can be specified, but it directly resolves the domain name to an IP address very early on via NewClientMuxFromProfile. This is unnecessary for TCP and cannot handle DDNS domain names for UDP (unless the client is restarted or reloaded).

Is there a better implementation, such as re-triggering the resolution when a reconnection occurs?

@enfein
Copy link
Author

enfein commented Nov 29, 2025

It is OK to pass domain name as is when creating Mux, and resolve the IP address inside NewStreamUnderlay and NewPacketUnderlay functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants