plone / plone.batching

Batching facilities for Plone
https://pypi.org/project/plone.batching
2 stars 8 forks source link

AssertionError: Having an orphan size higher than batch size is undefined #30

Closed arky closed 1 year ago

arky commented 2 years ago

Getting the following error on startup on Ubuntu 21.10

2022-01-08 12:31:17,762 ERROR   [Zope.SiteErrorLog:17][waitress-0] AssertionError: http://localhost:3000/@vocabularies/plone.app.vocabularies.SupportedContentLanguages
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.vocabularies.get, line 52, in reply
  Module plone.restapi.serializer.vocabularies, line 55, in __call__
  Module plone.restapi.batching, line 21, in __init__
  Module plone.batching.batch, line 35, in __init__
AssertionError: Having an orphan size higher than batch size is undefined
[10] > /home/arky/Code/Plone/Plone-6/backend/eggs/plone.batching-2.0.0a1-py3.9.egg/plone/batching/batch.py(35)__init__()
-> assert orphan <= size, "Having an orphan size higher than batch size" \
(Pdb++) 2022-01-08 12:31:17,930 ERROR   [Zope.SiteErrorLog:17][waitress-2] AssertionError: http://localhost:3000/@vocabularies/plone.app.vocabularies.Keywords
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.vocabularies.get, line 52, in reply
  Module plone.restapi.serializer.vocabularies, line 55, in __call__
  Module plone.restapi.batching, line 21, in __init__
  Module plone.batching.batch, line 35, in __init__
AssertionError: Having an orphan size higher than batch size is undefined
[10] > /home/arky/Code/Plone/Plone-6/backend/eggs/plone.batching-2.0.0a1-py3.9.egg/plone/batching/batch.py(35)__init__()
-> assert orphan <= size, "Having an orphan size higher than batch size" \
2022-01-08 12:31:18,138 ERROR   [Zope.SiteErrorLog:17][waitress-1] AssertionError: http://localhost:3000/@vocabularies/plone.app.vocabularies.Users
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.vocabularies.get, line 52, in reply
  Module plone.restapi.serializer.vocabularies, line 55, in __call__
  Module plone.restapi.batching, line 21, in __init__
  Module plone.batching.batch, line 35, in __init__
AssertionError: Having an orphan size higher than batch size is undefined
2022-01-08 12:31:18,143 ERROR   [Zope.SiteErrorLog:17][waitress-3] AssertionError: http://localhost:3000/@vocabularies/plone.app.vocabularies.Users
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 376, in publish_module
  Module ZPublisher.WSGIPublisher, line 271, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module plone.rest.service, line 22, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.vocabularies.get, line 52, in reply
  Module plone.restapi.serializer.vocabularies, line 55, in __call__
  Module plone.restapi.batching, line 21, in __init__
  Module plone.batching.batch, line 35, in __init__
AssertionError: Having an orphan size higher than batch size is undefined
[10] > /home/arky/Code/Plone/Plone-6/backend/eggs/plone.batching-2.0.0a1-py3.9.egg/plone/batching/batch.py(35)__init__()
-> assert orphan <= size, "Having an orphan size higher than batch size" \
[10] > /home/arky/Code/Plone/Plone-6/backend/eggs/plone.batching-2.0.0a1-py3.9.egg/plone/batching/batch.py(35)__init__()
-> assert orphan <= size, "Having an orphan size higher than batch size" \

Using

Plone 6.0.0a1 (6001)
CMF 2.5.4
Zope 5.3
Python 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0]
PIL 8.3.1 (Pillow)
WSGI: On
Server: waitress 2.0.0

Buildout.cfg

[buildout]
extends =
    https://dist.plone.org/release/6.0.0a1/versions.cfg
    versions.cfg

extensions =
    mr.developer
    buildout.sanitycheck
# Tell mr.developer to ask before updating a checkout.
always-checkout = true
show-picked-versions = true
sources = sources
# The directory this buildout is in. Modified when using vagrant.
buildout_dir = ${buildout:directory}

# We want to checkout these eggs directly from github
auto-checkout = *

parts =
    checkversions
    instance
    packages
    robot
    test
    zopepy
    repozo
    backup

eggs =
    Plone
    plone.volto
    Pillow
    politikus.contenttypes
    popolo.contenttypes
    politikus.bods
    ocds.contenttypes
    politikus.theme
    plone.app.imagecropping
    politikus.extractives
    politikus.naturalresource
    collective.celery
    collective.vocabularies.iso
    collective.volto.dropdownmenu

# development tools
    plone.reload
    Products.PDBDebugMode
    plone.app.debugtoolbar
    Products.PrintingMailHost
    pdbpp

# TTW Forms
    collective.easyform

# The addons we develop in the training
    ploneconf.site
    starzel.votable_behavior

zcml =

test-eggs +=
    ploneconf.site [test]

backups-dir=${buildout:buildout_dir}/var/backups

[configuration]
admin-user = admin
admin-password = admin

[instance]
recipe = plone.recipe.zope2instance
user = ${configuration:admin-user}:${configuration:admin-password}
http-address = 8080
debug-mode = on
verbose-security = on
deprecation-warnings = on
eggs = ${buildout:eggs}
zcml = ${buildout:zcml}
file-storage = ${buildout:buildout_dir}/var/filestorage/Data.fs
blob-storage = ${buildout:buildout_dir}/var/blobstorage
http-fast-listen = true
zodb-temporary-storage = off
zcml-additional =
    <configure xmlns="http://namespaces.zope.org/zope"
               xmlns:plone="http://namespaces.plone.org/plone">
        <plone:CORSPolicy
            allow_origin="http://localhost:3000,http://127.0.0.1:3000"
            allow_methods="DELETE,GET,OPTIONS,PATCH,POST,PUT"
            allow_credentials="true"
            expose_headers="Content-Length,X-My-Header"
            allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin,Lock-Token"
            max_age="3600"
        />
    </configure>

[test]
recipe = zc.recipe.testrunner
eggs = ${buildout:test-eggs}
defaults = ['--auto-color', '-vvv']

[robot]
recipe = zc.recipe.egg
eggs =
    ${buildout:test-eggs}
    Plone
    plone.volto
    Pillow
    plone.app.robotframework
    collective.MockMailHost
    robotframework-debuglibrary
    robotframework-requests
    robotframework-react
    robotframework-seleniumlibrary
    robotframework-selenium2library
    robotframework-webpack

[packages]
recipe = collective.recipe.omelette
eggs = ${buildout:eggs}
location = ${buildout:buildout_dir}/packages

[checkversions]
recipe = zc.recipe.egg
eggs = z3c.checkversions [buildout]

[zopepy]
recipe = zc.recipe.egg
eggs =
    ${buildout:eggs}
interpreter = zopepy

[backup]
# This recipe builds the backup, restore and snapshotbackup commands.
# For options see http://pypi.python.org/pypi/collective.recipe.backup
recipe = collective.recipe.backup
location = ${buildout:backups-dir}/incrementalbackup/backups
blobbackuplocation = ${buildout:backups-dir}/incrementalbackup/blobstoragebackups
snapshotlocation = ${buildout:backups-dir}/snapshotbackup/snapshotbackups
blobsnapshotlocation = ${buildout:backups-dir}/snapshotbackup/blobstoragesnapshots
# datafs = ${buildout:var-dir}/filestorage/Data.fs
# blob-storage = ${buildout:var-dir}/blobstorage
blob_timestamps = true

[repozo]
# This recipe builds the repozo script for non-zeo installations.
recipe = zc.recipe.egg
eggs = ZODB
scripts = repozo

[sources]
ploneconf.site = git https://github.com/collective/ploneconf.site.git rev=64406ca043e5
starzel.votable_behavior = git https://github.com/collective/starzel.votable_behavior.git
politikus.contenttypes = git https://github.com/Sinar/politikus.contenttypes
popolo.contenttypes = git https://github.com/Sinar/popolo.contenttypes
ocds.contenttypes = git https://github.com/Sinar/ocds.contenttypes
politikus.bods = git https://github.com/Sinar/politikus.bods
politikus.theme = git https://github.com/Sinar/politikus.theme
collective.vocabularies.iso = git https://github.com/Sinar/collective.vocabularies.iso
politikus.extractives = git https://github.com/Sinar/politikus.extractives branch=main
politikus.naturalresource = git https://github.com/Sinar/politikus.naturalresource branch=main
Rudd-O commented 2 years ago

Tip: your buildout.cfg text needs to be enclosed in triple quotes.

gforcada commented 1 year ago

Looking at the code, it seems that somehow when building the languages, keywords and users vocabularies on plone.restapi the amount of objects found were negative, as that would be the only way to trigger that size < orphan which is what this assert is about.

Could it be that there were some permission problems or that the installation was somehow broken and the serializers had a problem building this vocabularies?

As the issue is almost a year old, I'm closing it, but feel free to re-open if it still happens, hopefully not! 🍀