Skip to content

Problems with collecting coverage data for the uwsgi framework #2035

@WeiMengXS

Description

@WeiMengXS

Error:

2025-08-20 16:41:58.176397 : exception Couldn't use data file '/usr/local/services/xxxxxx/.coverage.cvm-api-0.112.XIvCOBix': no such table: context , Traceback (most recent call last)

I'm using uwsgi to start my service, and a thread is created to collect and report coverage data:

def _cover_report(_cover):
    reporter = Reporter(_cover, "{token}", "{server}", "{project_name}", "{raw_name}", "{commit}", trim_path,"{user_agent}",{flags})
    while True:
            try:
                wlog('whiletrue  %s , %s ' % (os.getpid(), {interval}))
                time.sleep({interval})
                result = reporter.run()
                _cover.erase()
                wlog(result)
            except Exception as e:
                msg = traceback.format_exc()
                wlog('exception %s , %s' % (e, msg))
                time.sleep({interval})


qcov_origin_application = {entrance_func}
def {entrance_func}(environ=None, start_response=None):
    cover.start()
    res =  qcov_origin_application(environ, start_response)
    global report_thread_started
    if not report_thread_started:
        thread = threading.Thread(target=_cover_report, args=(cover,))
        thread.setDaemon(True)
        thread.start()
        report_thread_started = True
    return res

It seems that the erase() step causes the database file of other processes to be deleted.

My expectation is that each process collects its own data and then reports them to my server independently.

Please give me some guidance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions