Debugging Catastrophic Backtracking for Regular Expressions in Python | Krishnan Chandra
Recently, I was debugging a Python application that had become stuck while processing certain inputs. The process was taking up 100% CPU time but not making progress. To try and figure out where the application was getting stuck, I turned to a handy profiling tool called py-spy.
Using py-spy to Find the Bottleneck py-spy is a sampling profiler for Python that lets you see where your code is spending time without modifying it. It can be used to get information from running Python processes, which is very helpful! I used the py-spy dump command to attach to the stuck Python process and print out a snapshot of the current call stack across all threads.
Krishnan