ResourceWarnings triggered by plone.restapi file uploads

In Plone 5.2.1, Python 3 I see a bunch of such messages during a migration (of File instances over plone.restapi).

/home/ajung/sandboxes/plone-server-buildout-plone5/eggs/ZODB-5.5.1-py3.7.egg/ZODB/ ResourceWarning: unclosed file <_io.FileIO name='/tmp/BUCakd0jzfp' mode='rb' closefd=True>
  super(BlobFile, self).close()
ResourceWarning: Enable tracemalloc to get the object allocation traceback

There are two related ZODB issues:

Should we care?

1 Like

I already looked for some information about it, and the only place with useful information is in the
What’s New In Python 3.2 (use find to get to the place about ResourceWarning), it states:

A ResourceWarning is also issued when a file object is destroyed without having been explicitly closed. While the deallocator for such object ensures it closes the underlying operating system resource (usually, a file descriptor), the delay in deallocating the object could produce various issues, especially under Windows.

@jensens @zopyx FYI: I started to look into this. Seems plone.scale is causing this:


Good catch