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

The ZODB should create the "tmp" directory for savepoint automatically if the target directory does not exist. #394

Open
zopyx opened this issue Oct 25, 2023 · 3 comments

Comments

@zopyx
Copy link
Member

zopyx commented Oct 25, 2023

A savepoint() call may cause the error

  File "/home/ajung/src/unibo/magazine-plone6/eggs/transaction-3.1.0-py3.11.egg/transaction/_transaction.py", line 627, in __init__
    savepoint = savepoint()
                ^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 984, in savepoint
    self._commit(None)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 544, in _commit
    self._store_objects(ObjectWriter(obj), transaction)
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 591, in _store_objects
    s = self._storage.storeBlob(oid, serial, p, blobfilename,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1186, in storeBlob
    targetpath = self._getBlobPath()
                 ^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/magazine-plone6/eggs/ZODB-5.8.1-py3.11.egg/ZODB/Connection.py", line 1215, in _getBlobPath
    blob_dir = tempfile.mkdtemp(dir=self.temporaryDirectory(),

if the target directory does not exist.
Better: the directory should be created automatically rather than failing implicitly.

@davisagli
Copy link
Member

What was the error at the end of the traceback?

@zopyx
Copy link
Member Author

zopyx commented Oct 25, 2023

Sorry for incomplete information.

The savepoints for blobs are created (by default) inside var/blobstorage/tmp. Only var/blobstorage existed.

This is also true in other contexts where the ZODB/Zope expects directory to exist for var/logs, var/instance, var/filestorage etc.

@davisagli
Copy link
Member

@zopyx What storages is your ZODB configured with?

From what I can see this temporary directory should normally be created when the blob storage is initialized: https://github.com/zopefoundation/ZODB/blob/master/src/ZODB/blob.py#L377-L378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants