sentry-python: pure_eval misses the variable on the crash line

(Related to https://github.com/getsentry/sentry-python/issues/748)

I keep experiencing the same situation for various crash reports in my project: the new “interesting variables” logic includes everything but the entities on the line where the crash happens. For example,

def foo(arg: Dict[str, str]):
    bar = arg[5]
    x = func()
    x.attr = "AttributeError"  # crash here
    ...

The visible variables in the stack trace are arg, bar, and even Dict[str, str] from typing (pufe_eval loves typing for some reason), but x - never. Yet the most important local stack information for me is the variables from the line where I raise an exception. I guess the variable suggestion logic can be hacked to prioritize the variables on that line.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Ok 0.17.3 is out. Let me know how it goes.

On Wed, Sep 2, 2020 at 10:47 AM Vadim Markovtsev notifications@github.com wrote:

Can you please release, it is hard for me to switch to master today.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getsentry/sentry-python/issues/805#issuecomment-685452263, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGMPRJW7QYP5HNMPSQTJIDSDYBBDANCNFSM4QQNFFDQ .

OK thanks, that helped. I’ve opened a PR to deal with trimming.

@vmarkovtsev I’m still not clear on whether this happens when you’ve got less than 10 variables. Your screenshot shows more than 10 so trimming is expected. It seems that the trimming has always been somewhat arbitrary so I’m surprised this wasn’t a problem before pure_eval, although adding more values probably exacerbated it.

Yes. I think the solution here is that pure_eval does its own trimming, such that it does not run into limits later, as it knows better what to trim first.