sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.45k stars 73 forks source link

SystemError: NULL object passed to Py_BuildValue #71

Closed aantn closed 3 years ago

aantn commented 3 years ago

On Python 2.7 when constantly calling start/stop/get_func_stats I repeatedly see the following error:

SystemError: NULL object passed to Py_BuildValue

Any idea what could be causing this?

sumerc commented 3 years ago

Hi,

What OS/Python version are you using? (with minor version info)

Could you provide a simple test script to reproduce the issue. E.x: I am running following script and could not see any issue on Python 2.7.16 on Ubuntu 64-bit:

import yappi
import time

def foo():
    time.sleep(0.1)

n = 0
while (n < 5):
    yappi.start()
    foo()
    yappi.stop()
    yappi.get_func_stats().print_all()

    n += 1
aantn commented 3 years ago

Your example doesn't reproduce the issue for me either. This example with multithreading does:

import yappi
import time
import thread

def foo():
    while 1:
        time.sleep(0.1)

n = 0
thread.start_new(foo, ())

while True:
    yappi.start()
    time.sleep(0.15)
    yappi.stop()
    yappi.get_func_stats().print_all()
sumerc commented 3 years ago

I have fixed the issue in #72 .

Thanks for reporting!