bjdgyc / anylink

AnyLink是一个企业级远程办公 ssl vpn 软件,可以支持多人同时在线使用。基于 openconnect 协议开发,并且借鉴了 ocserv 的开发思路,可以完全兼容 AnyConnect 客户端。
GNU Affero General Public License v3.0
1.66k stars 398 forks source link

解决IpAuditMap在UDP下的fatal error: concurrent map read and map write #123

Closed lanrenwo closed 2 years ago

lanrenwo commented 2 years ago

场景:开启UDP下的,会出现读写map冲突的问题

fatal error: concurrent map read and map write

goroutine 93826692 [running]:
runtime.throw({0xcfbea1?, 0x457953?})
    /usr/local/go/src/runtime/panic.go:992 +0x71 fp=0xc000813c58 sp=0xc000813c28 pc=0x445cb1
runtime.mapaccess2_faststr(0x1678360?, 0xc0002dbc00?, {0xc0013175f0, 0x22})
    /usr/local/go/src/runtime/map_faststr.go:117 +0x3d4 fp=0xc000813cc0 sp=0xc000813c58 pc=0x423054
github.com/bjdgyc/anylink/handler.logAudit(0xc0007fe7e0, 0xc000488e80)
    /root/go/src/addcn_anylink/server/handler/payload.go:130 +0x3d6 fp=0xc000813e40 sp=0xc000813cc0 pc=0xad13b6
github.com/bjdgyc/anylink/handler.payloadIn(0xc0007fe7e0, 0xc000488e80)
codecov-commenter commented 2 years ago

Codecov Report

Merging #123 (f65dde1) into dev (047e478) will increase coverage by 1.22%. The diff coverage is 88.46%.

@@            Coverage Diff             @@
##              dev     #123      +/-   ##
==========================================
+ Coverage   19.37%   20.60%   +1.22%     
==========================================
  Files          54       55       +1     
  Lines        2859     2907      +48     
==========================================
+ Hits          554      599      +45     
- Misses       2203     2204       +1     
- Partials      102      104       +2     
Impacted Files Coverage Δ
server/handler/payload.go 0.00% <0.00%> (ø)
server/sessdata/session.go 35.68% <25.00%> (-0.51%) :arrow_down:
server/pkg/utils/maps.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 047e478...f65dde1. Read the comment docs.