2021-01-06 18:48 阅读 1

How do we get Sentry to ignore uWSGI's OSError?

Sometimes when the client has already disconnected, uWSGI will log an error like:

Thu Sep 10 02:13:33 2015 - uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 331] during GET /_debug_toolbar/313339393934343438353938333532 (
OSError: write error

This will get recorded in Sentry even though there's nothing actionable from our end... So what do we do? Is there some uWSGI setting to get it to stop throwing this error? Can we get sentry or raven to ignore it?



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

7条回答 默认 最新

  • weixin_39569543 weixin_39569543 2021-01-06 18:48

    Usually you just acknowledge the error in Sentry and it won't send notifications anymore for this particular error. Ignoring OSError exception might hide other errors.

    点赞 评论 复制链接分享
  • weixin_39586353 weixin_39586353 2021-01-06 18:48

    Maybe knows.

    点赞 评论 复制链接分享
  • weixin_39586353 weixin_39586353 2021-01-06 18:48

    To be clear, I've never seen this personally before, so I'm not sure off the top of my head without investigating. :)

    点赞 评论 复制链接分享
  • weixin_39610721 weixin_39610721 2021-01-06 18:48

    I'm guessing it's because we're not buffing requests, so if a connection breaks in the middle of reading it inside our application code it needs to raise an exception so that we don't continue to process the request. What I don't really know is how not to have Sentry care about it since there's zero actionable thing for me to do here, a connection went away, it happens.

    Maybe we can convince uWSGI to use a subclass of OSError like ClientLostError or something and then can just filter out that particular exception.

    点赞 评论 复制链接分享
  • weixin_39610721 weixin_39610721 2021-01-06 18:48

    I just noticed the mute button in Sentry which hides this particular exception group. That should probably do what we want here.

    点赞 评论 复制链接分享
  • weixin_39677870 weixin_39677870 2021-01-06 18:48

    Related to getsentry/sentry#1850

    点赞 评论 复制链接分享
  • weixin_39562340 weixin_39562340 2021-01-06 18:48

    Another option is to switch on disable-write-exception in uWSGI config.

    点赞 评论 复制链接分享