Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
pdelboca merged 3 commits into
masterfrom
search-index-rebuild-force-traceback
Mar 2, 2022
Merged

search-index rebuild -i show traceback on fail#6329
pdelboca merged 3 commits into
masterfrom
search-index-rebuild-force-traceback

Conversation

@smotornyuk
Copy link
Copy Markdown
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