Some videos won't upload - EDIT: NodeJS 12.9-12.19.x causes timeouts after 60 seconds

Hello everyone,

I am a simple peertube user, I am not running a server.
I have been creating (with OBS) and uploading dozens of video on peertube from firefox. For some reason I sometimes get an error message when I want to upload a video :

Any idea what I shoud do ?
Thanks for your help!

hi @verduron,

This sounds like a misconfigured server, as uploading a video shouldn’t result in this kind of errors. I suggest getting in touch with your instance administrator first.

Thanks for your input @rigelk ! I will do that.
What surprises me is that it works for smaller videos, and it used to work for much larger ones.
Have a good day.

The instance administrator might have further limited the maximum body size in its reverse proxy configuration :thinking:

Feedback:
The admin didn’t have any trouble uploading the video himself. It doesn’t come from a limitation of the server.
I tried to clean the cache and to remove the add ons from my Firefox browser, it didn’t help. Switching to Chromium (Linux) didn’t do the trick either.

Interesting, but very strange. In any case, this 502 error is related to the reverse-proxy connection with the backend, not your browser.

Could your sysadmin provide more details about how the reverse-proxy is configured?

I’m the sysadmin for this instance. This case is quite strange. I’ve already had this kind of error when a user with a slow internet connection uploads a big file -> with my previous RP configuration ProxyTimeout 600 -> 10 minutes; when the upload ends after the timeout -> ERROR

My new RP configuration is :
LimitRequestBody 4294967294
ProxyTimeout 7200

For this specific case, @verduron can’t upload a short video. He sends me the file (39 Mo). I upload the file without any error.

I use this apache RP configuration available at a now OUTDATED httpd/Apache vhost to run PeerTube | note that only Nginx is supported by the PeerTube team, and with this or any other Apache configuration, you will likely get NO SUPPORT. · GitHub to configure my instance

with a little difference

ProxyTimeout 600 → 7200

my current configuration

cat /etc/apache2/sites-enabled/peertube.gcfamily.fr-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
   ServerName peertube.gcfamily.fr
   Redirect Permanent / https://peertube.gcfamily.fr/
   ErrorLog ${APACHE_LOG_DIR}/ssl_error_peertube.log
   CustomLog ${APACHE_LOG_DIR}/ssl_access_peertube.log combined

   Header always set X-Content-Type-Options nosniff
   Header always set X-Robots-Tag none
   Header always set X-XSS-Protection "1; mode=block"

        # Activate http/2
        Protocols h2 h2c http/1.1

        H2Push          on
        H2PushPriority  *                       after
        H2PushPriority  text/css                before
        H2PushPriority  image/jpeg              after   32
        H2PushPriority  image/png               after   32
        H2PushPriority  application/javascript  interleaved

        # Hard limit, PeerTube does not support videos > 4GB
        LimitRequestBody 4294967294

        # Set caching on assets for 1 year
        <FilesMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$>
                Header append Cache-Control "public, max-age=31536000, immutable"
        </FilesMatch>
        AliasMatch ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ /data/www-data/peertube/peertube-latest/client/dist/$1

        # Set caching on image files for 1 year
        <FilesMatch ^/static/(thumbnails|avatars)/(.*)$>
                Header append Cache-Control "public, max-age=31536000, immutable"
        </FilesMatch>
        AliasMatch ^/static/(thumbnails|avatars)/(.*)$ /data/www-data/peertube/storage/$1/$2

        # Bypass PeerTube webseed route for better performances
        Alias /static/webseed /data/www-data/peertube/storage/videos
        <Location /static/webseed>
                # Clients usually have 4 simultaneous webseed connections, so the real limit is 3MB/s per client
                SetOutputFilter RATE_LIMIT
                SetEnv rate-limit 1250

                SetEnvIf Request_Method "GET" GETMETH=1

                Header set Access-Control-Allow-Origin "*" env=GETMETH
                Header set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type" env=GETMETH
                Header set Access-Control-Allow-Methods "GET, OPTIONS" env=GETMETH
                Header set toto "foo" env=GETMETH
                SetEnvIf GETMETH "1" dontlog

                SetEnvIf Request_Method "OPTIONS" OPTIONSMETH=1

                Header set Access-Control-Allow-Origin "*" env=OPTIONSMETH
                Header set Access-Control-Allow-Headers "Range,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type" env=OPTIONSMETH
                Header set Access-Control-Allow-Methods "GET, OPTIONS" env=OPTIONSMETH
                Header set Access-Control-Max-Age "1000" env=OPTIONSMETH
                Header set Content-Type "text/plain charset=UTF-8" env=OPTIONSMETH
                Header set Content-Length "0" env=OPTIONSMETH
        </Location>

        <Location /videos/embed>
                Header unset X-Frame-Options
        </Location>

        ProxyPreserveHost On
        ProxyRequests Off
        ProxyTimeout 7200

        # Websocket tracker
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteRule /(.*) ws://127.0.0.1:9000/$1 [P,L]

        <Location />
                ProxyPass http://127.0.0.1:9000/
        </Location>

SSLCertificateFile /etc/letsencrypt/live/peertube.gcfamily.fr/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/peertube.gcfamily.fr/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

cat /etc/letsencrypt/options-ssl-apache.conf

SSLEngine on

# Intermediate configuration, tweak to your needs
SSLProtocol             all -SSLv2 -SSLv3
SSLCipherSuite          ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS
SSLHonorCipherOrder     on
SSLCompression          off

SSLOptions +StrictRequire

# Add vhost name to log entries:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common

root@srv:/etc/apache2# apachectl -M | egrep "proxy|http2|rate|header|ssl|rewrite"

headers_module (shared)
http2_module (shared)
proxy_module (shared)
proxy_http_module (shared)
proxy_wstunnel_module (shared)
ratelimit_module (shared)
rewrite_module (shared)
ssl_module (shared)

AH. I wrote this file, and explicitly marked it as outdated… It lacks nearly all performance optimizations, and it wasn’t checked for security ever since. Some other parts, like the request body maximum size you mention, were since modified in the reference Nginx configuration to 8Gb.

I’m no Apache expert, so I don’t know how it handles timeouts (responding with a 502?!), especially with a proxypass directive. In Nginx we also tune the timeout for proxypass.

I’ve just seen the OUTDATED status :sweat_smile:

I will have to migrate my web hosting stack from apache2 to nginx in order to have the supported configuration for peertube. That’s something I’m working on but I have several complexe Vhosts to migrate :dizzy_face:

I look forward to the next version of peertube with live broadcasting. I was planning to change my web hosting stack technology (apache2 -> nginx) for this version, to be able to use the rtmp protocol.

Eureka -

Finally I haven’t got any problems with my apache configuration. The problem is related to node.js installed version (12.19.1)

I’ve just downgraded my nodejs version from 12.19.1 to 12.16.0 and everything is working fine now.

link to the article that led me to the solution : https://stackoverflow.com/questions/64457453/broken-pipe-error-when-proxying-long-file-upload-request

The solution, as just as it might be, is not sourced nor verifiable in the release notes or NodeJS changelog. Do you have other sources?

i’ve found this issue on nodejs

1 « J'aime »

Thanks a bunch! We’re going to be more carefull with errors reporting timeouts when it comes to these nodejs versions.