Closed youzhixiaomutou closed 9 months ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.27%. Comparing base (
c9f1fc9
) to head (86d7f88
). Report is 17 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@youzhixiaomutou Thanks.
When I ran stress testing in prod environment, I found the buffer which is used by current request will be written by the previous request which has timeout. I found that setting
tw.timeout = true
and put buffer to pool is guarded by sync.mutex: https://github.com/gin-contrib/timeout/blob/c9f1fc9648482a03867dae552b1ef630600bb03c/timeout.go#L82-L86 But reading timeout is unsafed, so that it may cause a data race? I think set/read timeout and write/put buffer should be atomic, otherwise it will cause writing buffer which has already been put back to pool. https://github.com/gin-contrib/timeout/blob/c9f1fc9648482a03867dae552b1ef630600bb03c/writer.go#L29-L61