Overleaf: Content Length mismatch when compiling

Created on 26 Aug 2014  路  9Comments  路  Source: overleaf/overleaf

I am trying to compile some latex code. It compiles fine, but i get a content length mismatch for the spellchecker and the pdf document. Any ideas what it could be? Here is the web console output.

POST http://<host>/spelling/check net::ERR_CONTENT_LENGTH_MISMATCH jquery.min.js:4
POST http://<host>/spelling/check net::ERR_CONTENT_LENGTH_MISMATCH jquery.min.js:4
GET http://<host>/project/53fbad5e5de3204f067bfe19/output/output.pdf?cache_bust=1409004089380 net::ERR_CONTENT_LENGTH_MISMATCH 53fbad5e5de3204f067bfe19/output/output.pdf?cache_bust=1409004089380:1
GET http://<host>/project/53fbad5e5de3204f067bfe19/output/output.pdf?cache_bust=1409004089380 net::ERR_CONTENT_LENGTH_MISMATCH 

Most helpful comment

More info: I believe the real issue was corrupted file entries in /usr/local/var/run/nginx/*. The real fix came from http://stackoverflow.com/questions/22889338/javascript-not-loading-due-to-neterr-content-length-mismatch:

sudo nginx -s stop
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx

All 9 comments

I ran a full reinstall, and the projects that already exist work, but i encounter this again with new projects.

The only error i can find in the logs is

SyncTeX written on /var/lib/sharelatex/data/compiles/53fbb6f8e8136d4003b49861/output.synctex.gz.'output.fls' and '/var/lib/sharelatex/data/compiles/53fbb6f8e8136d4003b49861/output.fls' are identical (not copied) at /usr/local/texlive/2014/bin/x86_64-linux/latexmk line 6454.
Latexmk: Log file says output to 'output.pdf'
Latexmk: ===For rule 'pdflatex', actual output 'output.pdf'
       ======appears not to match expected output '/var/lib/sharelatex/data/compiles/53fbb6f8e8136d4003b49861/output.pdf'
Latexmk: Undoing directory change

And im not sure if this is an error.

This seems to be a problem with the nginx proxy, as it works if i access directly. I only used the one provided though. Here are my nginx settings:

server {
    listen         80;
    server_name    <domain>; # Catch all, see http://nginx.org/en/docs/http/server_names.html

    set $static_path /srv/sharelatex/web/public;

    location / {
        proxy_pass http://localhost:3000;
        proxy_set_header Host $http_x_forwarded_host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 3m;
        proxy_send_timeout 3m;
    }

    location /stylesheets {
        expires 1y;
        root $static_path/;
    }

    location /minjs {
        expires 1y;
        root $static_path/;
    }

    location /img {
        expires 1y;
        root $static_path/;
    }
}

Solved, it was the nginx config. This worked for me:

upstream sharelatex_cluster {
        server 127.0.0.1:3000;
}


server {
    server_name <domain>;
    access_log /srv/logs/sharelatex.log;
    error_log /srv/logs/sharelatex-error.log;
    set $static_path /srv/sharelatex/web/public;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_buffering off;
        proxy_pass http://sharelatex_cluster/;
    }
    location /stylesheets {
        expires 1y;
        root $static_path/;
    }

    location /minjs {
        expires 1y;
        root $static_path/;
    }

    location /img {
        expires 1y;
        root $static_path/;
    }
}

For anyone else who finds this: I believe that the one line that makes the difference is proxy_buffering off;. Adding just that at the top of my http { ... } section fixed the issue for me.

More info: I believe the real issue was corrupted file entries in /usr/local/var/run/nginx/*. The real fix came from http://stackoverflow.com/questions/22889338/javascript-not-loading-due-to-neterr-content-length-mismatch:

sudo nginx -s stop
sudo rm -rf /usr/local/var/run/nginx/*
sudo nginx

@marcuswestin,
Last solution worked for me.

Thank you a lot!

@marcuswestin - last solution worked for me as well. Thx!!

Nice :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferdn4ndo picture ferdn4ndo  路  5Comments

marcAC picture marcAC  路  6Comments

ShellCode33 picture ShellCode33  路  4Comments

luspi picture luspi  路  4Comments

adrianvb picture adrianvb  路  5Comments