Updating apps results in 500 error because of db connection lost

  • Nextcloud Server version (e.g., 29.x.x):
    • 33.0.5
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 24.04
  • Database
    • Mariadb 11.8
  • Cache server
    • redis
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.58
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Apache/2.4.58
  • PHP version (e.g, 8.3):
    • 8.4.22
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • After updating to 33
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • docker Nextcloud official image
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Updating an app succeeds, but i recieve an 500 error after some seconds. To resolve this, I have to restart the nextcloud-app container. Sometimes I get this 500 error after updating a 2nd app.

Steps to replicate it (hint: details matter!):

  1. Update an app through the web interface.

  2. Wait until it has succeeded

  3. Update another app or navigate to another place in nextcloud

  4. A 500 error appears in the browser

Log entries

Nextcloud

No specific errors in the application container nor nextcloud log.. I do see this error in the database container (mariadb 11.8, I used 11.4 up until NC32)

[Warning] Aborted connection 7928 to db: 'nextcloud-db' user: 'nextcloud-user' host: '172.24.0.4' (Got an error reading communication packets)

When I see this error in the db container - I receive the 500 error in nextcloud so the culprint is a lost connection between Nextcloud & database.

Configuration

Nextcloud

Nextcloud config

{
“system”: {
“htaccess.RewriteBase”: “/”,
“memcache.distributed”: “\OC\Memcache\Redis”,
“filelocking.enabled”: true,
“memcache.locking”: “\OC\Memcache\Redis”,
“allow_local_remote_servers”: true,
“redis”: {
“host”: “REMOVED SENSITIVE VALUE”,
“password”: “REMOVED SENSITIVE VALUE”,
“port”: 6379
},
“memcache.local”: “\OC\Memcache\APCu”,
“apps_paths”: [
{
“path”: “/var/www/html/apps”,
“url”: “/apps”,
“writable”: false
},
{
“path”: “/var/www/html/custom_apps”,
“url”: “/custom_apps”,
“writable”: true
}
],
“instanceid”: “REMOVED SENSITIVE VALUE”,
“passwordsalt”: “REMOVED SENSITIVE VALUE”,
“secret”: “REMOVED SENSITIVE VALUE”,
“trusted_domains”: [
mycloud.com
],
“datadirectory”: “REMOVED SENSITIVE VALUE”,
“dbtype”: “mysql”,
“version”: “33.0.5.1”,
“overwrite.cli.url”: “https://liencloud.be”,
“dbname”: “REMOVED SENSITIVE VALUE”,
“dbhost”: “REMOVED SENSITIVE VALUE”,
“dbport”: “”,
“dbtableprefix”: “oc_”,
“mysql.utf8mb4”: true,
“dbuser”: “REMOVED SENSITIVE VALUE”,
“dbpassword”: “REMOVED SENSITIVE VALUE”,
“installed”: true,
“trusted_proxies”: “REMOVED SENSITIVE VALUE”,
“forwarded_for_headers”: [
“HTTP_X_FORWARDED_FOR”
],
“overwritehost”: “liencloud.be”,
“overwriteprotocol”: “https”,
“default_phone_region”: “BE”,
“loglevel”: 2,
“maintenance”: false,
“enable_previews”: true,
“enabledPreviewProviders”: [
“OC\Preview\PNG”,
“OC\Preview\JPEG”,
“OC\Preview\GIF”,
“OC\Preview\BMP”,
“OC\Preview\XBitmap”,
“OC\Preview\MP3”,
“OC\Preview\TXT”,
“OC\Preview\MarkDown”,
“OC\Preview\OpenDocument”,
“OC\Preview\Krita”,
“OC\Preview\Movie”,
“OC\Preview\PNG”,
“OC\Preview\MP4”,
“OC\Preview\PDF”
],
“mail_domain”: “REMOVED SENSITIVE VALUE”,
“mail_from_address”: “REMOVED SENSITIVE VALUE”,
“mail_smtpmode”: “smtp”,
“mail_sendmailmode”: “smtp”,
“mail_smtphost”: “REMOVED SENSITIVE VALUE”,
“mail_smtpport”: “587”,
“remember_login_cookie_lifetime”: 1296000,
“session_lifetime”: 86400,
“app_install_overwrite”: [
“radio”,
“files_external_onedrive”,
“side_menu”,
“news”,
“maps”
],
“theme”: “”,
“memories.exiftool”: “/var/www/html/custom_apps/memories/bin-ext/exiftool-aarch64-glibc”,
“memories.vod.path”: “/var/www/html/custom_apps/memories/bin-ext/go-vod-aarch64”,
“memories.vod.ffmpeg”: “/usr/bin/ffmpeg”,
“memories.vod.ffprobe”: “/usr/bin/ffprobe”,
“mail_smtpsecure”: “tls”,
“mail_smtpauthtype”: “LOGIN”,
“mail_smtpauth”: 1,
“mail_smtpname”: “REMOVED SENSITIVE VALUE”,
“mail_smtppassword”: “REMOVED SENSITIVE VALUE”,
“maintenance_window_start”: 1,
“memories.db.triggers.fcu”: true,
“memories.gis_type”: 1,
“preview_max_x”: 2048,
“preview_max_y”: 2048,
“preview_max_filesize_image”: 10,
“preview_max_memory”: 128,
“preview_max_scale_factor”: 1,
“gs.trustedHosts”: [
myothercloud.com
]
}
}

Docker-compose.yml

services:

  db:
    image: mariadb:11.8
    container_name: nextcloud-db
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW --innodb-file-per-table=1 --skip-innodb-read-only-compressed
    networks:
      - nextcloud_network
    volumes:
      - ./mount/mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      - MYSQL_ROOT_PASSWORD=XXX
      - MYSQL_PASSWORD=XXX
      - MYSQL_DATABASE=nextcloud-db
      - MYSQL_USER=nextcloud-user
    restart: unless-stopped

  redis:
    image: redis
    container_name: nextcloud-redis
    restart: unless-stopped
    networks:
      - nextcloud_network
    command: redis-server --save 20 1 --loglevel warning --requirepass YYYY
  
  nextcloud:
    build:
      context: .
      dockerfile: dockerfile
    container_name: nextcloud-app
    networks:
      - nextcloud_network
    ports:
      - 8080:80
    depends_on:
      - db
      - redis
    volumes:
      - nextcloud:/var/www/html
      - ./mount/nextcloud/config:/var/www/html/config
      - ./mount/nextcloud/custom_apps:/var/www/html/custom_apps
      - ./mount/nextcloud/data:/var/www/html/data
      - ./mount/nextcloud/themes:/var/www/html/themes
      - ./mount/custom_php.ini:/usr/local/etc/php/conf.d/nextcloud.ini
      - /etc/localtime:/etc/localtime:ro
      - ./mount/nextcloud/opcache-recommended.ini:/usr/local/etc/php/conf.d/opcache-recommended.ini 
    restart: unless-stopped

volumes:
  nextcloud:

networks:
  nextcloud_network:
    ipam:
      config:
       - subnet: 172.24.0.0/24

Things I’ve tried so far

Opcache settings

Upon updating from 32 → 33 I recieved this error:

Can’t start Nextcloud because the version of the data (Warning: JIT on AArch64 doesn’t support opcache.jit_buffer_size above 128M. in Unknown on line 032.0.8.2) is higher than the docker image version

So I changed the value of opcache.jit_buffer_size from 256M → 128M

For reference, this is my full opcache.ini file

opcache.enable=1
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=10000
opcache.memory_consumption=256
opcache.save_comments=1
opcache.revalidate_freq=60
opcache.jit=1255
opcache.jit_buffer_size=128M
opcache.enable_cli=1

Nextcloud maintenance

I used the following occ commands to perform any repairs within Nextcloud:

occ db:add-missing-indices
occ db:convert-filecache-bigint
occ maintenance:repair

No output of any repairs

I also tried to rebuild the container image but this also didn’t change a thing.

DB parameters

As per gemini ai recommendations, I added the following extra parameters to my mariadb command but to no avail

--character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci
--max-allowed-packet=256M --net-read-timeout=120 --net-write-timeout=120 --innodb-buffer-pool-size=512M

How could I solve this problem? Thanks in advance