Volto + Nginx >>> ClientDisconnected error on ZEO

Hi All

I've been around this problem for a couple of days now and am running out of ideas. Any help would be greatly appreciated!

I am getting a ClientDisconnected error thrown by ZEO on Plone5 with Volto whenever I upload images, but not other types of files.

For example, I get the error uploading images as small as 100KB, but don't get any errors uploading a 8MB file, both via Volto. I also don't get any errors if I upload directly in Plone5, bypassing Volto, in which case I can upload whichever images I want, irrespective of size, always successfully.

So clearly, the issue seems to be in the Volto deployment itself, but I don't get it when uploading large files, which makes this hard to debug and fix.

Volto and Plone5 are running on K8S on GCP, Plone5 being a separate common service I can plug multiple Volto instances to. These volto instances are composed of an NGINX + Volto running on a single container, done this way to address CORS issues.

This is the NGINX config (a segment of it)

#################################################
#######  UPSTREAM SERVERS
#################################################
# This specifies which IP and port Volto is running on.
upstream frontend {
    server localhost:3000;
    keepalive 32;
}

# This specifies which IP and port Plone5 is running on.
upstream backend {
    server plone5-service;
    keepalive 32;
    keepalive_timeout 90s;
}

#################################################
#######  PUBLIC site NGINX Config
#################################################

location ~(.*)$ {

  proxy_set_header        Connection "keep-alive";
  proxy_set_header        Host $host;
  proxy_set_header        X-Real-IP $remote_addr;
  proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header        X-Forwarded-Proto $scheme;
  proxy_http_version      1.1;
  proxy_pass              http://frontend;

  location ~* \.(js|jsx|css|less|swf|eot|ttf|otf|woff|woff2)$ {
      add_header Cache-Control "public";
      expires +1m;
      proxy_pass http://frontend;
  }

  location ~* static.*\.(ico|jpg|jpeg|png|gif|svg)$ {
      add_header Cache-Control "public";
      expires +1m;
      proxy_pass http://frontend;
  }

  location ~ /api($|/.*) {
    rewrite ^/api($|/.*) /VirtualHostBase/http/mysite.com/Plone/VirtualHostRoot/$1 break;
    proxy_pass http://backend;
  }

}

The error I get is an HTTP 500, logged in the Plone5 backend as follows:

Time
24 Jul, 2021 11:59 AM
User Name
admin (admin)
Request URL
http://mysite.com/images/POST_application_json_
Exception Type
ClientDisconnected
Exception Value
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 497, in commit
Module ZODB.Connection, line 546, in _commit
Module ZODB.Connection, line 595, in _store_objects
Module ZODB.mvccadapter, line 180, in storeBlob
Module ZEO.ClientStorage, line 618, in storeBlob
Module ZEO.asyncio.client, line 777, in async_iter
Module ZEO.asyncio.client, line 748, in call
Module ZEO.asyncio.client, line 756, in wait_for_result
Module concurrent.futures._base, line 435, in result
Module concurrent.futures._base, line 384, in __get_result
ZEO.Exceptions.ClientDisconnected

To reiterate, I only get this with images, even small ones. Large files uploaded via Volto work beautifully.

Versions:

Plone 5.2.4 (5212)
CMF 2.5.0
Zope 4.5.5
Python 3.7.11 (default, Jul 22 2021, 15:59:35) [GCC 8.3.0]
PIL 6.2.2 (Pillow)
WSGI: On
Server: waitress 1.4.4

Volto: built from Docker plone/volto:13.2.2
nginx: Built from Docker nginx

Any pointers?

Thank you very much in advance!

Joe