Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search-index rebuild -i show traceback on fail #6329

Merged
merged 3 commits into from
Mar 2, 2022

Conversation

smotornyuk
Copy link
Member

When the search index is rebuilt, error traceback is printed to the output if an error occurs, and -i/--force flag is provided. This is done by the cgitb.text function.

The problem is that the mentioned function is doing something like getattr(x, y, DEFAULT) in order to get the current value of variables inside a particular stack frame. As soon as it meets the LocalProxy object, it fails. Builtin getattr expects/catches an AttributeError when property is not available, but LocalProxy raises an RuntimeError. In this way, we can't get traceback at all.

There are two options:

  • Inherit LocalProxy and rewrite __getattr__. As we already have extensions that are expecting RuntimeError, it may cause a problem. In addition, I don't want to rewrite the existing 3rd-party method just because it's not compatible with another existing 3rd-party method
  • Switch to the simpler traceback.format_tb. We won't see local variables, but everyone still can see the place where the error happened and start debugging from there, so it's not such a big issue

As you may guess, I picked the second option.

@smotornyuk smotornyuk force-pushed the search-index-rebuild-force-traceback branch 2 times, most recently from 23e64c7 to 4bb501d Compare August 17, 2021 10:18
@smotornyuk smotornyuk force-pushed the search-index-rebuild-force-traceback branch from 6c92801 to aabfe8a Compare February 15, 2022 11:29
@pdelboca pdelboca merged commit 1fb6ad9 into master Mar 2, 2022
@pdelboca pdelboca deleted the search-index-rebuild-force-traceback branch March 2, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants