Ошибка при сборке чанков код ошибки 502

Nextcloud community

Loading

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Closed

MartiniMoe opened this issue

Feb 12, 2020

· 8 comments

Assignees

@MartiniMoe

Comments

@MartiniMoe

When uploading huge files (> 4GB) via the webinterface the following error occurs after the upload finished:
Error when assembling chunks, status code 502
I’ve found hints changing the PHP timeout etc, but I dont know how to do that with the docker-compose.yml

@ouissla

Hi, I have the same issue here. Did you manage to solve this problem?
In my case I get the 502 when trying to assemble 38 chunks of 100Mb each. I have already set a high memory limit, increased all possible timeout related values, and still the script returns a 502 after 3 seconds.

@jorisbaiutti

I have the same issue, but already with 1GB Files. I use S3 storage as the primary storage. Without S3 it works fine.
The weird thing is though, that the file is uploaded completely after page refresh. I also can see it in the S3 Storage. While uploading it stores 10MB chunks, after page refresh there is a 1GB file.

@killarbyte

any luck of getting things to work out of the box ?

@jorisbaiutti

@supermar1010

@jorisbaiutti I have the same problem, just that it sometimes doesn’t store the file/reports the wrong size
@ouissla How did you increase these limits? I’m using the conteainer with the apache inside

@sebastiansterk

Having the exact same issue.
Steps to reproduce:

  • Nextcloud 20 or 21 docker image
  • Configure S3 as primary storage according to the nextcloud documentation
  • upload a 5GB file
    —> Error when assembling chunks, status code 502

@sebastiansterk

Guys, I was able to fix the issue.
The problem is that when the upload finished, Nextcloud is trying to assemble the chunks. The frontend sends a MOVE request to the Nextcloud server, this request runs in a timeout. The default timeout for ProxyTimeout is the value of Timeout. Default value is set to 60 seconds.
In this case, nextcloud cannot finish assembling the chunks within the defined timeout of your Reverse Proxy.
To fix this issue you have to increase the ProxyTimeout and/or Timeout of your reverse proxy that is routing the requests to your nextcloud docker container.
I’m using apache, so adding the following part to my httpd.conf fixed the issue for me (restart of apache is required):

Timeout 2400
ProxyTimeout 2400

@MartiniMoe

Thanks a lot!
Guess this can get closed then :)

И необязательно чтобы вы использовали Nginx в качестве прокси для доступа к сети. Нет, для работы большинства сайтов требуется генерация динамического контента, например, на php. Поэтому Nginx часто выступает в прокси для Apache или php-fpm. В этой статье мы рассмотрим что означает 502 bad gateway Nginx, как исправить ее.

Что означает 502 bad gateway Nginx

Как и следует из названия, эта ошибка значит, что Nginx попытался связаться со шлюзом и у него ничего не вышло. Например, запросы от пользователей принимает Nginx, поскольку он работает быстро и потребляет мало ресурсов, а за генерацию контента отвечает php-fpm. Если сервис php-fpm во время обработки запроса получил какую-либо ошибку и не вернул результата, или же он вообще отключен и Nginx не может получить к нему доступ мы получим такую ошибку.

Вот основные причины:

Как исправить ошибку 502 bad gateway Nginx

1. Анализ логов и перезапуск

Это уже должно дать вам некоторые подсказки что делать дальше. Еще в первую очередь не помешает проверить файл конфигурации Nginx на ошибки:

Допустим, у нас в качестве шлюза для генерации динамического содержимого используется php-fpm. Тогда нужно проверить запущен ли вообще этот сервис:

Если все процессы уже запущены, попробуйте перезапустить их с помощью systemd:

sudo systemctl restart php-fpm

Если процесс остановлен, то его нужно запустить:

sudo systemctl start php-fpm

Это самая распространенная причина, вызывающая ошибку 502 Bad Gateway и обычно после перезапуска сервиса все будет работать, вам осталось выяснить только почему он завершился. В этом вам может помочь просмотр лога php-fpm:

Но если такой рецепт не помог, и ошибка 502 bad gateway nginx нужно идти дальше. Внимательно пересмотрите лог, возможно, там уже есть ответ.

2. Доступность php-fpm и владелец

Также эта ошибка может возникать при проблемах доступа к файлу сокета php-fpm, например, когда этот файл называется по другому или для него выставлены неверные права. Сначала убедитесь, что в конфигурационном файле /etc/nginx/nginx. conf указан правильный адрес файла сокета php-fpm:

.php$ <
fastcgi_pass unix:/var/run/php7.0-fpm. sock;
include fastcgi_params;
>

Файл /var/run/php7.0-fpm. sock должен действительно существовать в файловой системе. Дальше нужно убедиться, что у сокета правильный владелец, это должен быть тот же пользователь, от имени которого запускается Nginx, группа тоже должна соответствовать. Откройте файл /etc/php7.0/fpm/pool. d/www. conf и найдите строчки user и group. Они должны иметь такое же значение, как строчка user в конфиге nginx. conf:

listen = /var/run/php7.0-fpm. sock
listen. owner = www-data
listen. group = www-data

После того как выставите правильные параметры, перезапустите сервисы:

sudo service php5-fpm restart
$ sudo service nginx restart

3. Время отклика и размер буфера

Возможно, размер буфера и время ожидания ответа от fastcgi настроены неверно и программа просто не успевает обработать большой запрос. Попробуйте увеличить такие параметры в /etc/nginx/nginx. conf. Если таких строк не существует, добавьте их в блок http, как здесь:

sudo vi /etc/nginx/nginx. conf

http <
.
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
.
>

Выводы

В этой статье мы рассмотрели 502 bad gateway nginx что это значит и как исправить эту ошибку. Как видите, может быть достаточно много причин ее возникновения, но решить все достаточно просто если внимательно посмотреть логи и понять в чем там действительно проблема. Надеюсь, информация была полезной для вас.

Ошибка 502 bad gateway – что это значит и как исправить

Иногда вместо сайта в браузере появляется страница с ошибкой. Рядом с сообщением об ошибке часто приведен код, который поможет распознать и устранить неисправность. Разберемся с кодом 502 bad gateway – что же это значит, и как зайти на нужный сайт.

Причины ошибки

Что означает код ошибки 502? Он сообщает о «плохом шлюзе» – сервер, на котором размещен нужный вам интернет-ресурс, при обращении вернул некорректный ответ. Это происходит из-за избыточной нагрузки – шлюз не может обработать поступивший запрос и не отправляет нужные данные.

Браузер с ошибкой 502

Обычно ошибка 502 bad gateway возникает, если:

Есть и другие причины возникновения ошибка 502 – проблемы с адресом DNS или прокси-сервером. В любом случае, эта неисправность не зависит от компьютера пользователя и его настроек.

Как исправить

При появлении 502 bad gateway – как же исправить проблему? Полностью устранить ошибку на удаленном сервере вы не сможете, но ряд действий может помочь получить доступ на сайт:

Очистка кэша в Хроме

Из-за кэшированных и временных файлов вы можете видеть ошибку даже тогда, когда на сервере она уже устранена. Чтобы удалить cookies, заходите в настройки браузера:

Если после всех действий ошибка все равно появляется, зайдите на сайт позже. Администраторы ресурса устранят проблему или схлынет поток пользователей, доступ восстановится.

Заключение

Мы разобрались, что такое ошибка 502 в браузере и как поступить для ее устранения. Помогут простые действия – обновление страницы, очистка временных файлов. Если ничего не помогло – зайдите на ресурс чуть позже, когда он не будет перегружен.

Источники:

https://losst. ru/chto-znachit-502-bad-gateway-nginx

https://droidov. com/502-bad-gateway-kak-ispravit

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I’ve searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud’s Code of Conduct.

Bug description

Upload a file, say 400 MB. After upload progress bar completes, there is a Processing files step. After a minute or so, there is this error message Error when assembling chunks, status code 504 . Eventually, the file is uploaded and would show up in the web interface, yet, there is this error. Depending on the size of the file, clamscan takes 100% of the CPU.
Doesnt occur with smaller files say few MBs.

Nextcloud error

Steps to reproduce

  1. Upload a file, say 400 MB and wait the upload progress bar completes,
  2. Wait for the Processing files step
  3. After a minute or so, there is this error message Error when assembling chunks, status code 504
  4. Although the error message, the file is uploaded eventually after several minutes, depending on the file size. During this period all CPU time is taken by clamav

Expected behavior

No error message.

Installation method

Official All-in-One appliance

Operating system

Debian/Ubuntu

PHP engine version

PHP 7.4

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO — SAML
  • Other

Configuration report

## Server configuration detail

**Operating system:** Linux 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64

**Webserver:** Apache (fpm-fcgi)

**Database:** pgsql PostgreSQL 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit

**PHP version:** 7.4.3

Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, sodium, cgi-fcgi, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, json, ldap, exif, pdo_pgsql, pgsql, apc, posix, readline, shmop, SimpleXML, soap, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Phar, Zend OPcache

**Nextcloud version:** 23.0.3 - 23.0.3.2

**Updated from an older Nextcloud/ownCloud or fresh install:** 

**Where did you install Nextcloud from:** unknown

<details><summary>Signing status</summary>

Array
(
)

</details>

<details><summary>List of activated apps</summary>


Enabled:
 - accessibility: 1.9.0
 - activity: 2.15.0
 - admin_audit: 1.13.0
 - afterlogic: 2.0.3
 - analytics: 4.2.1
 - announcementcenter: 6.1.1
 - appointments: 1.12.2
 - apporder: 0.15.0
 - calendar: 3.2.2
 - checksum: 1.1.3
 - circles: 23.1.0
 - cloud_federation_api: 1.6.0
 - cms_pico: 1.0.18
 - comments: 1.13.0
 - contacts: 4.1.0
 - contactsinteraction: 1.4.0
 - dashboard: 7.3.0
 - dav: 1.21.0
 - deck: 1.6.1
 - event_update_notification: 1.5.0
 - external: 3.10.2
 - federatedfilesharing: 1.13.0
 - federation: 1.13.0
 - files: 1.18.0
 - files_antivirus: 3.2.2
 - files_external: 1.15.0
 - files_pdfviewer: 2.4.0
 - files_rightclick: 1.2.0
 - files_sharing: 1.15.0
 - files_trashbin: 1.13.0
 - files_versions: 1.16.0
 - files_videoplayer: 1.12.0
 - firstrunwizard: 2.12.0
 - forms: 2.5.0
 - fulltextsearch_elasticsearch: 23.0.0
 - groupfolders: 11.1.2
 - integration_onedrive: 1.1.2
 - logreader: 2.8.0
 - lookup_server_connector: 1.11.0
 - maps: 0.1.10
 - music: 1.5.1
 - nextcloud_announcements: 1.12.0
 - notes: 4.3.1
 - notifications: 2.11.1
 - oauth2: 1.11.0
 - onlyoffice: 7.3.2
 - password_policy: 1.13.0
 - photos: 1.5.0
 - privacy: 1.7.0
 - provisioning_api: 1.13.0
 - ransomware_protection: 1.12.0
 - recommendations: 1.2.0
 - serverinfo: 1.13.0
 - settings: 1.5.0
 - sharebymail: 1.13.0
 - support: 1.6.0
 - survey_client: 1.11.0
 - systemtags: 1.13.0
 - tasks: 0.14.4
 - text: 3.4.1
 - theming: 1.14.0
 - twofactor_backupcodes: 1.12.0
 - twofactor_totp: 6.2.0
 - unsplash: 1.2.4
 - updatenotification: 1.13.0
 - user_retention: 1.6.0
 - user_status: 1.3.1
 - viewer: 1.7.0
 - weather_status: 1.3.0
 - workflow_script: 1.8.0
 - workflowengine: 2.5.0
Disabled:
 - encryption
 - user_ldap

Configuration (config/config.php)

{
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "*.*.*.*",
        "nextcloud",
        "www.cloudcreator.eu"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "dbtype": "pgsql",
    "version": "23.0.3.2",
    "overwrite.cli.url": "https://nextcloud/",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "log_type": "file",
    "logfile": "/var/log/nextcloud/nextcloud.log",
    "loglevel": "2",
    "log.condition": {
        "apps": [
            "admin_audit"
        ]
    },
    "mail_smtpmode": "smtp",
    "logtimezone": "Europe/Brussels",
    "maintenance": false,
    "updater.release.channel": "stable",
    "memcache.local": "\OC\Memcache\APCu",
    "default_phone_region": "BE",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_sendmailmode": "smtp",
    "mail_smtpauthtype": "LOGIN",
    "mail_smtpauth": 1,
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "25",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "theme": ""
}

Cron Configuration: Array
(
[backgroundjobs_mode] => cron
[lastcron] => 1649751002
)

External storages: yes

External storage configuration

Encryption: no

User-backends:

  • OCUserDatabase

Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0



### List of activated Apps

```shell
<details><summary>List of activated apps</summary>


Enabled:
 - accessibility: 1.9.0
 - activity: 2.15.0
 - admin_audit: 1.13.0
 - afterlogic: 2.0.3
 - analytics: 4.2.1
 - announcementcenter: 6.1.1
 - appointments: 1.12.2
 - apporder: 0.15.0
 - calendar: 3.2.2
 - checksum: 1.1.3
 - circles: 23.1.0
 - cloud_federation_api: 1.6.0
 - cms_pico: 1.0.18
 - comments: 1.13.0
 - contacts: 4.1.0
 - contactsinteraction: 1.4.0
 - dashboard: 7.3.0
 - dav: 1.21.0
 - deck: 1.6.1
 - event_update_notification: 1.5.0
 - external: 3.10.2
 - federatedfilesharing: 1.13.0
 - federation: 1.13.0
 - files: 1.18.0
 - files_antivirus: 3.2.2
 - files_external: 1.15.0
 - files_pdfviewer: 2.4.0
 - files_rightclick: 1.2.0
 - files_sharing: 1.15.0
 - files_trashbin: 1.13.0
 - files_versions: 1.16.0
 - files_videoplayer: 1.12.0
 - firstrunwizard: 2.12.0
 - forms: 2.5.0
 - fulltextsearch_elasticsearch: 23.0.0
 - groupfolders: 11.1.2
 - integration_onedrive: 1.1.2
 - logreader: 2.8.0
 - lookup_server_connector: 1.11.0
 - maps: 0.1.10
 - music: 1.5.1
 - nextcloud_announcements: 1.12.0
 - notes: 4.3.1
 - notifications: 2.11.1
 - oauth2: 1.11.0
 - onlyoffice: 7.3.2
 - password_policy: 1.13.0
 - photos: 1.5.0
 - privacy: 1.7.0
 - provisioning_api: 1.13.0
 - ransomware_protection: 1.12.0
 - recommendations: 1.2.0
 - serverinfo: 1.13.0
 - settings: 1.5.0
 - sharebymail: 1.13.0
 - support: 1.6.0
 - survey_client: 1.11.0
 - systemtags: 1.13.0
 - tasks: 0.14.4
 - text: 3.4.1
 - theming: 1.14.0
 - twofactor_backupcodes: 1.12.0
 - twofactor_totp: 6.2.0
 - unsplash: 1.2.4
 - updatenotification: 1.13.0
 - user_retention: 1.6.0
 - user_status: 1.3.1
 - viewer: 1.7.0
 - weather_status: 1.3.0
 - workflow_script: 1.8.0
 - workflowengine: 2.5.0
Disabled:
 - encryption
 - user_ldap

«`

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

https://www.cloudcreator.eu/index.php/s/4yj4bQTiHqqdntB

Additional info

No response



    • #1

    Hi Everyone,

    I am facing this issue when I’m trying to upload bigger files to my NextCloud. I definitely need to have the possibility to upload bigger files as I need to share files for video editing — it’s not uncommon to have 20GB+ files. How can I solve this issue? I saw some forum posts where they are talking about an apache issue but that shouldn’t be relevant to me. Not sure what information you need so I attached some screenshots to have some info about the system.

    1. Running containers in Portainer

    2. Basic system info (CPU, Kernel, etc.)

    3. File systems

    4. Disks

    • Offizieller Beitrag
    • #2
    • #3

    Thanks for the links, I checked them out but I’m not sure what to do with it to be honest. It seems like I will have some help during the weekend and hopefully he is going to help me figuring out what to do. I suspect I have some issues with encryption. I basically just want to turn it off but unfortunately it’s not as easy as it is to turn it on.

    • #4

    Maybe look at «step 9» at https://www.linuxbabe.com/ubun…tu-20-04-nginx-lemp-stack. Modify the size according to your needs. Maybe the files are in different locations, but if you look at the instructions above of the guide, you should be able to understand what should be in the files (i.e. how they should look like to know if you are working on the correct file).

Понравилась статья? Поделить с друзьями:
  • Ошибка при сбое active directory
  • Ошибка при розжиге газового котла что делать
  • Ошибка при решении элементарной задачи
  • Ошибка при речи замена букв
  • Ошибка при репликации днк какая изменчивость