Version 4.0.5

Released: June 8, 2021

Status: Stable



Support was added for changing Celery’s maximum memory and maximum tasks per worker. These setting help kill and re-spawn workers in a predictable manner which helps reclaim lost memory due to memory leaks of the programs executed by the background tasks. The environment variables MAYAN_WORKER_X_MAX_MEMORY_PER_CHILD and MAYAN_WORKER_X_MAX_TASKS_PER_CHILD were added where _X_ corresponds to the respective worker.

Support was added for modifying Gunicorn’s --limit-request-line setting via the MAYAN_GUNICORN_LIMIT_REQUEST_LINE environment variable.

The Docker image environment variables chapter was improved. Some missing environment variables were added. The default values were automated by taking the values from the code. The environment variables were organized by topic.

A commented Docker compose port entry for the database was added. Uncommenting this entry opens up the database port to the outside and allows easier backups and management of the database.


The upgrade instructions of the release notes was converted into a partial template that is now inserted into every release note instance. This helps avoid errors and differences in the upgrade procedure of the releases of the same series.


Several improvements were made to the document file and document version page image generation.

The document version page base image cache invalidation on source image transformation updates was improved. This fixes an edge case were changes to the document file page were not being registered in the document version page.

The transformation list generation of the document files and document versions was optimized by replacing several loops with list extensions. The speed increase is minimal per unit but since this segment of code is called we often the effect is measurable.

The source content transformations are not longer used when calculating the document version transformation list hash. This fixes an edge case where the effect of some transformations was duplicated.

The way the document version page image API URL hash is generated was improved to increase its uniqueness. This ensures browsers do not use a cached document version page image when the transformations of the source object of the version are updated.


An error that was triggered by leaving empty a required metadata field during the upload wizard was fixed


The trashed documents are now excluded from the workflow runtime proxy document count column.


  • None

Upgrade process

Docker Compose

Check the Docker upgrading chapter for the complete upgrade process.

Direct deployment

Upgrading from Mayan EDMS 3.5.x


Supervisord must be upgraded to version 4.2.2. See troubleshooting section: After upgrade to version 4.1

  1. Stop supervisord:

    sudo systemctl stop supervisor
  2. Make a backup of your supervisord file:

    sudo cp /etc/supervisor/conf.d/mayan-edms.conf /etc/supervisor/conf.d/mayan-edms.conf.bck
  3. Make a backup of your database:

    Use the respective backup command for the database:

  4. Upgrade to the latest pip version:

    sudo --user=mayan /opt/mayan-edms/bin/pip install --upgrade pip
  5. Remove deprecated requirements:

    sudo --user=mayan curl --output /tmp/removals.txt \
    && sudo --user=mayan /opt/mayan-edms/bin/pip uninstall --requirement /tmp/removals.txt --yes
  6. Update the Mayan EDMS Python package:

    sudo --user=mayan /opt/mayan-edms/bin/pip install mayan-edms==4.4.5

    the requirements will also be updated automatically.

  7. Update the Redis configuration to serve at least 3 databases:


    databases ...


    databases 3
  8. Restart Redis for the changes to take effect:

    sudo systemctl restart redis
  9. Edit the config file at /opt/mayan-edms/media/config.yml:




    LOCK_MANAGER_BACKEND: mayan.apps.lock_manager.backends.redis_lock.RedisLock
    LOCK_MANAGER_BACKEND_ARGUMENTS: {'redis_url':'redis://:mayanredispassword@<IP address of Redis server>:6379/2'}
  10. Update the supervisord configuration file. Replace the environment variables values shown here with your respective settings. This step will refresh the supervisord configuration file with the new queues and the latest recommended layout:

    sudo --user=mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ platformtemplate supervisord | sudo sh -c "cat > /etc/supervisor/conf.d/mayan-edms.conf"
  11. Edit the supervisord configuration file and update any setting specific to your installation:

    sudo vi /etc/supervisor/conf.d/mayan-edms.conf
  12. Migrate existing database schema and static media files with:

    sudo --user=mayan MAYAN_MEDIA_ROOT=/opt/mayan-edms/media/ \
    /opt/mayan-edms/bin/ performupgrade
  13. Start supervisord:

    sudo systemctl start supervisor
  14. Clear the browser cache to avoid loading old web assets.

The upgrade procedure is now complete.


If you observe the errors:

  • mayan.apps.file_caching.models.CachePartitionFile.DoesNotExist: CachePartitionFile matching query does not exist.


  • FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/mayan/document_file_storage/...

follow the solution outlined in the troubleshooting section: After upgrade to version 4.0

Backward incompatible changes

  • None

Issues closed