Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use sync.Map in request transpot's packet conn server #3130

Merged

Conversation

xiaokangwang
Copy link
Contributor

This pull request fixes the issue within packet conn server, where a map is accessed without protection.

Thanks @dyhkwong for reporting this bug.

fatal error: concurrent map read and map write

goroutine 4895 [running]:
github.com/v2fly/v2ray-core/v5/transport/internet/request/assembler/packetconn.(*requestToPacketConnServer).OnRoundTrip(0xc000639e30, {0x1d514e8, 0xc000639cb0}, {{0xc00b3a8800, 0x0, 0x200}, {0xc006268940, 0x10, 0x10}}, {0xc0000907a0, ...})
	github.com/v2fly/v2ray-core/v5/transport/internet/request/assembler/packetconn/req2packet.go:206 +0xd3
github.com/v2fly/v2ray-core/v5/transport/internet/request/assembler/packetconn.(*udpAssemblerServer).OnRoundTrip(0xc00c8bfa28?, {0x1d514e8?, 0xc000639cb0?}, {{0xc00b3a8800, 0x0, 0x200}, {0xc006268940, 0x10, 0x10}}, {0xc0000907a0, ...})
	github.com/v2fly/v2ray-core/v5/transport/internet/request/assembler/packetconn/udpassemblerServer.go:144 +0x8b
github.com/v2fly/v2ray-core/v5/transport/internet/request/roundtripper/httprt.(*httpTripperServer).onRequest(0xc00062cfc0, {0x1d4cbf0, 0xc007710e00}, 0xc00736d560)
	github.com/v2fly/v2ray-core/v5/transport/internet/request/roundtripper/httprt/httprt.go:151 +0x4a4
github.com/v2fly/v2ray-core/v5/transport/internet/request/roundtripper/httprt.(*httpTripperServer).ServeHTTP(0x9e12f9?, {0x1d4cbf0?, 0xc007710e00?}, 0xc00c8bfb68?)
	github.com/v2fly/v2ray-core/v5/transport/internet/request/roundtripper/httprt/httprt.go:111 +0x1d
net/http.serverHandler.ServeHTTP({0xc0075517d0?}, {0x1d4cbf0?, 0xc007710e00?}, 0x6?)
	net/http/server.go:3142 +0x8e
net/http.(*conn).serve(0xc007e7c120, {0x1d514e8, 0xc00068a0f0})
	net/http/server.go:2044 +0x5e8
created by net/http.(*Server).Serve in goroutine 7
	net/http/server.go:3290 +0x4b4

@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Project coverage is 35.00%. Comparing base (346ca66) to head (8ba512c).
Report is 31 commits behind head on master.

Files Patch % Lines
...nternet/request/assembler/packetconn/req2packet.go 0.00% 13 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3130      +/-   ##
==========================================
- Coverage   35.59%   35.00%   -0.60%     
==========================================
  Files         729      741      +12     
  Lines       41613    42596     +983     
==========================================
+ Hits        14812    14910      +98     
- Misses      25167    26046     +879     
- Partials     1634     1640       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xiaokangwang xiaokangwang merged commit 3e7dc35 into v2fly:master Aug 24, 2024
37 of 39 checks passed
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.

2 participants