[MM-60307] Fix racy use of session in NewWebConn (#28195)

Этот коммит содержится в:
Ben Schumacher
2024-09-19 14:10:17 +02:00
коммит произвёл GitHub
родитель d6c11d1d26
Коммит 40d2ae97f1
3 изменённых файлов: 56 добавлений и 10 удалений

Просмотреть файл

@@ -17,6 +17,11 @@ import (
func (ps *PlatformService) ReturnSessionToPool(session *model.Session) {
if session != nil {
session.Id = ""
// Once the session is retrieved from the pool, all existing prop fields are cleared.
// To avoid a race between clearing the props and accessing it, clear the props maps before returning it to the pool.
clear(session.Props)
// Also clear the team members slice to avoid a similar race condition.
clear(session.TeamMembers)
ps.sessionPool.Put(session)
}
}