Python cProfile/pstats causing overflow?

0

I'm trying to profile a pretty big project using the following decorator on my main() function, but at line 9 I get a "Process finished with exit code -1073741571 (0xC00000FD)", which searching on Google seems to refer to a stack overflow.

Does that mean I can't profile my entire program all at once? I'm not using recursion, which seems to be a common cause of this issue. My project uses evolutive algorithms, like NSGA3. I noticed that changing the number of evolution iterations can make the issue not happen, but there isn't a clear pattern (the problem happens with 10 iterations, but not 200).

Is there a way to get more information other than the exit code to help me find the issue? I tried following the variables using pycharm's debugger, but it didn't help as I don't really know what I'm looking for. Checking inside pstats, the execution goes init->self.init->self.load_stats->arg.create_stats->self.snapshot_stats->self.getstats and that's where it stops with exit code -1073741571 (0xC00000FD).

I know you guys are limited without the full code, but any suggestions as to how I can track down the issue are welcomed.

def inner(*args, **kwargs):
    pr = cProfile.Profile()
    pr.enable()
    retval = fnc(*args, **kwargs)
    pr.disable()
    s="dirpath\\profiling_cumulative.txt"
    with open(s,'w') as stream:#io.StringIO()
        sortby = 'cumulative'
        ps = pstats.Stats(pr, stream=stream) #the program stops here 
        ps.sort_stats(sortby)
        ps.print_stats()
    s="dirpath\\profiling_tottime.txt"
    with open(s,'w') as stream:
        sortby = 'tottime'
        ps = pstats.Stats(pr, stream=stream).sort_stats(sortby)
        ps.print_stats()
    return retval
python
stack-overflow
exit-code
cprofile
asked on Stack Overflow Mar 24, 2021 by user1912475

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0