weixin_39629352
weixin_39629352
2020-11-26 14:51

race condition in CurlHandleContainer

While digging through the code I spotted a race condition in CurlHandleContainer::CheckAndGrowPool() -- it can be called by multiple threads at the same time and updates it's state in an unsafe way.

Problems: 1. instead of doubling size -- it triples it 2. if multiple threads execute it at the same time -- they can push cache size over limit specified by user 3. current cache size is updated in an unsafe manner -- it can lead to mysterious effects (like hanging in ExclusiveOwnershipResourceManager<>::ShutdownAndWait() 4. there is no reason for ExclusiveOwnershipResourceManager<>::m_shutdown to be atomic -- access to it is always protected by mutex

该提问来源于开源项目:aws/aws-sdk-cpp

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39761880 weixin_39761880 5月前

    That's a bug, thank you for reporting it, we will fix it soon,

    点赞 评论 复制链接分享
  • weixin_39629352 weixin_39629352 5月前

    You closed the bug, but as I see it -- size of cache still gets tripled instead of doubled...

    点赞 评论 复制链接分享
  • weixin_39761880 weixin_39761880 5月前

    We have explained why we allow this aggressive allocation in the commit log.

    On Fri, Aug 25, 2017 at 6:44 PM crusader-mike wrote:

    You closed the bug, but as I see it -- size of cache still gets tripled instead of doubled...

    — You are receiving this because you modified the open/close state.

    Reply to this email directly, view it on GitHub https://github.com/aws/aws-sdk-cpp/issues/636#issuecomment-325071383, or mute the thread https://github.com/notifications/unsubscribe-auth/ADTsCGpPnrlWv6Askv1IUq0InDJ0FO6Cks5sb3hfgaJpZM4O4iAS .

    --

    Best Regards!

    Liang.

    Software Engineer Game Developer

    点赞 评论 复制链接分享
  • weixin_39761880 weixin_39761880 5月前

    The pool size will not grow over the maximum limit

    点赞 评论 复制链接分享
  • weixin_39629352 weixin_39629352 5月前

    No probs, I thought you left original promise (doubling size on growth) in place.

    点赞 评论 复制链接分享

相关推荐