Repository navigation
Conversation
|
这个pattern在core中被大量使用 不会有问题的 defer 要执行的函数从执行到那一行起就固定了 |
|
After this modification, the memory leak that I analysed with pprof wasn't repeated. That was the error, I believe. |
|
提供一下goroutine的 pprof |
|
After the error repeated, I can say that the problem occurs when the system is configured to use VLESS Reality with mlkem768 encryption. If the connection is stable, everything works fine. But as soon as you turn off the connection, the memory leak appears. Here are the heap and goroutine dumps. |
|
try 1bae46b |
|
Yes, it fixes the heap and goroutine leak, even without my modifications. |
你试下使用其它传输层(比如 WS)时有没有问题 |
On error, Handshake returns (nil, err) → conn becomes nil.
defer conn.Close() (declared above) attempts to close nil → panic.
The original connection (raw net.Conn) is lost but not closed → descriptor and memory leak.
What modification does:
The original conn is preserved before calling Handshake.
On error, the original connection is explicitly closed → no leak.
defer conn.Close() (the outer one) will no longer panic because conn did not become nil (the error returns before reassignment).