I'm checking ZEO code, I think I found a buggy code. I think this is a big issue… for ZEO 5.
Do you have any comment or any suggestion?
My situation:
- I make a custom content type by DX.
- This content type has muluti files field.
- Making the content with large two files (about 8MB each).
- I got a client error and a zeoserver error.
I think the similar situation: https://community.plone.org/t/uploading-large-files-from-a-dexterity-content-type/7763
client error:
```
2022-10-19 12:35:20,336 INFO [ZEO.ClientStorage:434][zeostorage zeo client networking thread] zeostorage Disconnected from storage: "('db1', 8100)"
2022-10-19 12:35:20,337 INFO [ZEO.asyncio.base:51][zeostorage zeo client networking thread] Connected Protocol(('db1', 8100), '1', False)
2022-10-19 12:35:20,339 INFO [ZEO.ClientStorage:366][zeostorage zeo client networking thread] zeostorage Reconnected to storage: ('db1', 8100)
2022-10-19 12:35:20,384 ERROR [Zope.SiteErrorLog:252][waitress-1] 1666150520.38427880.4276333452962233 http://127.0.0.1:8081/Plone/ja/XXXXX
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 168, in transaction_pubevents
Module transaction._manager, line 257, in commit
Module transaction._manager, line 134, in commit
Module transaction._transaction, line 282, in commit
Module transaction._compat, line 49, in reraise
Module transaction._transaction, line 273, in commit
Module transaction._transaction, line 456, in _commitResources
Module transaction._compat, line 49, in reraise
Module transaction._transaction, line 430, in _commitResources
Module ZODB.Connection, line 492, in commit
Module ZODB.Connection, line 1058, in _commit_savepoint
Module ZODB.mvccadapter, line 175, in store
Module ZEO.ClientStorage, line 569, in store
Module ZEO.asyncio.client, line 774, in async_
Module ZEO.asyncio.client, line 748, in call
Module ZEO.asyncio.client, line 756, in wait_for_result
Module concurrent.futures._base, line 432, in result
Module concurrent.futures._base, line 384, in __get_result
ZEO.Exceptions.ClientDisconnected
```
zeoserver error:
```
2022-10-19T12:35:10 (0.0.0.0:8100) disconnected during unlocked transaction
2022-10-19T12:35:10 Connected server protocol
2022-10-19T12:35:10 received handshake 'Z5'
2022-10-19T12:35:10 (0.0.0.0:8100) no current transaction: tpc_abort()
2022-10-19T12:35:20 Bad async request, 'storeBlobStart'
Traceback (most recent call last):
File "/XXXXXXX/buildout-cache/eggs/ZEO-5.2.2-py3.6.egg/ZEO/asyncio/server.py", line 103, in message_received
result = getattr(self.zeo_storage, name)(*args)
File "/XXXXXXX/buildout-cache/eggs/ZEO-5.2.2-py3.6.egg/ZEO/StorageServer.py", line 460, in storeBlobStart
assert self.blob_tempfile is None
AssertionError
2022-10-19T12:35:20 Bad async request, 'storeBlobStart'
Traceback (most recent call last):
File "/XXXXXXX/buildout-cache/eggs/ZEO-5.2.2-py3.6.egg/ZEO/asyncio/server.py", line 103, in message_received
result = getattr(self.zeo_storage, name)(*args)
File "/XXXXXXX/buildout-cache/eggs/ZEO-5.2.2-py3.6.egg/ZEO/StorageServer.py", line 460, in storeBlobStart
assert self.blob_tempfile is None
AssertionError
2022-10-19T12:35:20 (0.0.0.0:8100) disconnected during unlocked transaction
2022-10-19T12:35:20 Connected server protocol
2022-10-19T12:35:20 received handshake 'Z5'
2022-10-19T12:35:20 (0.0.0.0:8100) no current transaction: tpc_abort()
```
I checked ZEO code.
https://github.com/zopefoundation/ZEO/blob/423cb8563be3e1ee0bb4297ee980d9b74f09c710/src/ZEO/ClientStorage.py#L687
https://github.com/zopefoundation/ZEO/blob/master/src/ZEO/StorageServer.py#L468
ClientStorage.py#L687:
Starting save the blobfile and finishing the blobfile.
StorageServer.py#L468:
Cheking working temp file for `assert self.blob_tempfile is None`.
I think this class instance (class ZEOStorage(object):) is sigle by ZEO server, It means self.blob_tempfile is single. And I think this process is Async.
I worry about,
- I think `self.blob_tempfile` was confrict, when uploading large two files in same transaction.
- There is no closeed the file, if getting the error. It mean to use a number of file descriptor.