Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPy + coverage.combine, load, report = disk I/O error #928

Open
arcivanov opened this issue Feb 2, 2020 · 2 comments
Open

PyPy + coverage.combine, load, report = disk I/O error #928

arcivanov opened this issue Feb 2, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@arcivanov
Copy link
Contributor

Looks like PyPy causes sqlite to have delayed file closing resulting in the following failure:

  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/control.py", line 872, in report
    return reporter.report(morfs, outfile=file)
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/summary.py", line 45, in report
    for fr, analysis in get_analysis_to_report(self.coverage, morfs):
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/report.py", line 70, in get_analysis_to_report
    analysis = coverage._analyze(fr)
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/control.py", line 774, in _analyze
    return Analysis(data, it, self._file_mapper)
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/results.py", line 34, in __init__
    mba = self.missing_branch_arcs()
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/results.py", line 129, in missing_branch_arcs
    missing = self.arcs_missing()
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/results.py", line 88, in arcs_missing
    executed = self.arcs_executed()
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/results.py", line 80, in arcs_executed
    executed = self.data.arcs(self.filename) or []
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/sqldata.py", line 886, in arcs
    with self._connect() as con:
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/sqldata.py", line 1024, in __enter__
    self._connect()
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/sqldata.py", line 1012, in _connect
    self.execute("pragma journal_mode=off").close()
  File "/home/arcivanov/Documents/src/arcivanov/pybuilder/.pybuilder/plugins/pypy-2.7.13.final.42/site-packages/coverage/sqldata.py", line 1063, in execute
    raise CoverageException("Couldn't use data file {!r}: {}".format(self.filename, msg))
CoverageException: Couldn't use data file '/home/arcivanov/Documents/src/arcivanov/pybuilder/target/run_unit_tests.coverage': disk I/O error

It looks like the issue is related to https://bitbucket.org/pypy/pypy/issues/2872/default-isolation-mode-is-different-on

Same code works on CPython 2.7, 3.5 - 3.8 on both Windows and Linux, both 32 and 64 bit with no issues.

The workaround for this is to completely disable gc while the coverage is running:

import gc
gc.disable()
@arcivanov arcivanov added the bug Something isn't working label Feb 2, 2020
arcivanov added a commit to arcivanov/pybuilder that referenced this issue Feb 2, 2020
Fix virtualenv being created on PyPy
Fix remote logging
Coverage on PyPy 2 fails in what looks like sqlite GC/file closing issue
GC around coverage is disabled temporarily pending resolution of nedbat/coveragepy#928
@nedbat
Copy link
Owner

nedbat commented Feb 4, 2020

This does look concerning, but isn't happening in my test suite. Can you give me steps to reproduce it?

@nedbat nedbat added this to the 5.0.4 milestone Feb 4, 2020
@arcivanov
Copy link
Contributor Author

I wish, it literally depends on how much garbage is generated so it's really hard to reproduce except in specific code where it always happens (i.e. turning on PyCharm debugger causes the issue to become non-reproducible while simple execution reproduces it every time).

Also notice this is PyPy2 7.3.0 (pypy-2.7.13.final.42)

@nedbat nedbat removed this from the 5.0.4 milestone Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants