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

test_dbm_gnu.test_reorganize() failed on x86-64 High Sierra 3.x #78082

Closed
vstinner opened this issue Jun 19, 2018 · 24 comments
Closed

test_dbm_gnu.test_reorganize() failed on x86-64 High Sierra 3.x #78082

vstinner opened this issue Jun 19, 2018 · 24 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-mac tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 33901
Nosy @warsaw, @ronaldoussoren, @vstinner, @ned-deily, @serhiy-storchaka, @zhangyangyu, @mattbillenstein, @miss-islington
PRs
  • Use more specific asserts in dbm tests. #7786
  • [3.7] Use more specific asserts in dbm tests. (GH-7786) #7787
  • [3.6] Use more specific asserts in dbm tests. (GH-7786) #7788
  • bpo-33901: Enhance test_dbm_gnu #7790
  • bpo-33901: Fix test_dbm_gnu for gdbm 1.15 #7791
  • bpo-33901: Add _gdbm._GDBM_VERSION #7794
  • bpo-33901: Better test_dbm_gnu.test_reorganize() fix #7795
  • [3.7] bpo-33901: Fix test_dbm_gnu for gdbm 1.15 #7798
  • [3.6] bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7798) #7801
  • [2.7] bpo-33901: Fix test_gdbm for gdbm 1.15 (GH-7798) #7818
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-06-20.08:57:53.912>
    created_at = <Date 2018-06-19.08:50:25.277>
    labels = ['OS-mac', '3.8', '3.7', 'tests']
    title = 'test_dbm_gnu.test_reorganize() failed on x86-64 High Sierra 3.x'
    updated_at = <Date 2018-06-20.08:57:53.909>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2018-06-20.08:57:53.909>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-06-20.08:57:53.912>
    closer = 'vstinner'
    components = ['macOS', 'Tests']
    creation = <Date 2018-06-19.08:50:25.277>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33901
    keywords = ['patch']
    message_count = 24.0
    messages = ['319942', '319951', '319952', '319953', '319954', '319955', '319956', '319957', '319958', '319959', '319960', '319962', '319963', '319964', '319966', '319982', '319983', '319987', '319988', '319998', '319999', '320000', '320038', '320039']
    nosy_count = 8.0
    nosy_names = ['barry', 'ronaldoussoren', 'vstinner', 'ned.deily', 'serhiy.storchaka', 'xiang.zhang', 'mattbillenstein', 'miss-islington']
    pr_nums = ['7786', '7787', '7788', '7790', '7791', '7794', '7795', '7798', '7801', '7818']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue33901'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @vstinner
    Copy link
    Member Author

    http://buildbot.python.org/all/#/builders/145/builds/81

    x86-64 High Sierra 3.x:

    ======================================================================
    FAIL: test_reorganize (test.test_dbm_gnu.TestGdbm)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_dbm_gnu.py", line 77, in test_reorganize
        self.assertTrue(size0 < size1)
    AssertionError: False is not true

    The only change of this build is the commit cb97073: bpo-33630. But I hardly believe that it's related.

    @vstinner vstinner added 3.8 only security fixes OS-mac tests Tests in the Lib/test dir labels Jun 19, 2018
    @serhiy-storchaka
    Copy link
    Member

    New changeset 22525de by Serhiy Storchaka in branch 'master':
    Use more specific asserts in dbm tests. (GH-7786)
    22525de

    @serhiy-storchaka
    Copy link
    Member

    http://buildbot.python.org/all/#/builders/145/builds/84

    ======================================================================
    FAIL: test_reorganize (test.test_dbm_gnu.TestGdbm)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/Users/buildbot/buildarea/3.x.billenstein-sierra/build/Lib/test/test_dbm_gnu.py", line 77, in test_reorganize
        self.assertGreater(size1, size0)
    AssertionError: 16777216 not greater than 16777216

    @serhiy-storchaka
    Copy link
    Member

    16777216 = 2**24 = 16 MiB

    Looks too large for the size of an empty database.

    @vstinner
    Copy link
    Member Author

    @matt Billenstein: Hi! Would you mind to have a look at this issue? It seems like test_dbm_gnu started to fail today. Did you upgrade the buildbot worker recently?

    @serhiy-storchaka
    Copy link
    Member

    For comparison, on Linux size0 = 12288 = 12 KiB. 3 decimal orders smaller.

    @vstinner
    Copy link
    Member Author

    size0=16777216 (16 MiB). On my Fedora 28, size0=12288 (12 KiB).

    Even more strange: another test starts by removing the filename, just in case!?

        def test_error_conditions(self):
            # Try to open a non-existent database.
            unlink(filename)
            ...

    Maybe the setUp() method must fail if filename already exists?

    The buildbot runs tests in subprocesses:
    "Run tests in parallel using 2 child processes"

    regrtest spawns child procsses which creates their own temporary empty current directory and TESTFN is related to the current directory. If the filename/database existed before test_reorganize(), it's likely a bug in test_dbm_gnu: but there is a single TestCase class with a tearDown() method which calls unlink(filename).

    --

    Maybe x86-64 High Sierra 3.x has a different dbm library version which always creates an empty database with 16 MiB preallocated on disk!?

    @vstinner
    Copy link
    Member Author

    Ok, I reproduced the issue on macOS High-Sierra and gdbm 1.15. Creating a DB creates a file of 16 MiB.

    macbook:master haypo$ brew info gdbm
    gdbm: stable 1.15 (bottled)
    GNU database manager
    https://www.gnu.org/software/gdbm/
    /usr/local/Cellar/gdbm/1.15 (19 files, 569.8KB)
    Poured from bottle on 2018-06-19 at 13:48:35
    From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gdbm.rb
    ==> Options
    --with-libgdbm-compat
    Build libgdbm_compat, a compatibility layer which provides UNIX-like dbm and ndbm interfaces.

    and

    macbook:master haypo$ ./python.exe
    Python 3.8.0a0 (heads/master:22525de, Jun 19 2018, 13:56:57) 
    [Clang 9.1.0 (clang-902.0.39.1)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import dbm.gnu
    >>> import os
    >>> dbm.gnu.open("x", "c").close()
    >>> os.path.getsize("x")
    16777216

    @serhiy-storchaka
    Copy link
    Member

    PR 7791 makes the test less useful.

    I suggest to replace 10000 with size0 or max(size0, 10000).

    @vstinner
    Copy link
    Member Author

    New changeset 1261bfa by Victor Stinner in branch 'master':
    bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7791)
    1261bfa

    @zhangyangyu
    Copy link
    Member

    Considering adding gdbm version to pythoninfo? It is possible to expose version info from gnu dbm.

    @serhiy-storchaka
    Copy link
    Member

    Did not increasing the size of the value fixed the test?

    @vstinner
    Copy link
    Member Author

    Xiang: "Considering adding gdbm version to pythoninfo? It is possible to expose version info from gnu dbm."

    I wrote PR 7794. What do you think of this?

    @vstinner
    Copy link
    Member Author

    Serhiy Storchaka: "Did not increasing the size of the value fixed the test?"

    Honestly, I don't understand the purpose of the test. Why does *Python* check such low level implementation detail, the exact file size used by gdbm? We are supposed to only test the API, no? If someone wants to change something else, I would suggest to remove test_reorganize().

    @serhiy-storchaka
    Copy link
    Member

    How can we test an API if calling it doesn't have any effect? reorganize() can be a no-op method, and still pass the test.

    @vstinner
    Copy link
    Member Author

    New changeset c44d8e5 by Victor Stinner in branch 'master':
    bpo-33901: Better test_dbm_gnu.test_reorganize() fix (GH-7795)
    c44d8e5

    @vstinner
    Copy link
    Member Author

    New changeset 13c79c6 by Victor Stinner in branch '3.7':
    bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7798)
    13c79c6

    @miss-islington
    Copy link
    Contributor

    New changeset fe8122d by Miss Islington (bot) in branch '3.6':
    bpo-33901: Fix test_dbm_gnu for gdbm 1.15 (GH-7798)
    fe8122d

    @serhiy-storchaka
    Copy link
    Member

    The buildbot is green again!

    @vstinner
    Copy link
    Member Author

    New changeset 00f9edb by Victor Stinner in branch 'master':
    bpo-33901: Add _gdbm._GDBM_VERSION (GH-7794)
    00f9edb

    @vstinner
    Copy link
    Member Author

    Ok, the test have been fixed in 3.6, 3.7 and master. I added a private version number in master.

    If someone wants to add a public version number, please go ahead but open a new issue.

    @vstinner
    Copy link
    Member Author

    Thanks Serhiy and Xiang for the reviews and to help to debug this bug.

    @vstinner
    Copy link
    Member Author

    Oh, the test also fails on 2.7:

    x86-64 High Sierra 2.7
    http://buildbot.python.org/all/#builders/140/builds/25

    I backported the fix to 2.7: PR 7818.

    @vstinner vstinner reopened this Jun 20, 2018
    @vstinner
    Copy link
    Member Author

    New changeset f291888 by Victor Stinner in branch '2.7':
    bpo-33901: Fix test_gdbm for gdbm 1.15 (GH-7798) (GH-7818)
    f291888

    @vstinner vstinner added the 3.7 (EOL) end of life label Jun 20, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes OS-mac tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants