composer / packagist

Package Repository Website - try https://packagist.com if you need your own -
https://packagist.org/
MIT License
1.75k stars 475 forks source link

Problems with packagist.org hosting? "zlib_decode(): data error" #743

Closed casperbakker closed 7 years ago

casperbakker commented 8 years ago

Over the weekend and also today, I keep getting zlib_decode(): data error errors when running composer update.

Updating dependencies (including require-dev)
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2015.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2016-01.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2016-04.json from cache
Downloading http://packagist.org/p/provider-2016-07%246b517546e49b0fd18faae23db87a75a1de24f8262098f9018ef06586e4485100.json
Writing /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2016-07.json into cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-2016-10.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
Downloading http://packagist.org/p/provider-latest%24984b3c6e517457760c54952b2bb925ad599f2f7bdc544b5e6d7441a279d2eb46.json
Writing /home/picqer/.composer/cache/repo/https---packagist.org/p-provider-latest.json into cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-h4cc$wkhtmltopdf-amd64.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-shuber$curl.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-knplabs$knp-snappy.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-picqer$bol-plaza-php-client.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-pronamic$twinfield.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-sneek$gocardless-pro.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-bluetools$moneybird-php-api.json from cache
Reading /home/picqer/.composer/cache/repo/https---packagist.org/provider-bugsnag$bugsnag.json from cache
Downloading http://packagist.org/p/nikic/php-parser%24811d3fa160a94187d8924b24f6f272424abd123fe72868f4590f981d9917b685.json
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading http://packagist.org/p/nikic/php-parser%24811d3fa160a94187d8924b24f6f272424abd123fe72868f4590f981d9917b685.json
Downloading http://packagist.org/p/nikic/php-parser%24811d3fa160a94187d8924b24f6f272424abd123fe72868f4590f981d9917b685.json
Downloading http://packagist.org/p/nikic/php-parser%24811d3fa160a94187d8924b24f6f272424abd123fe72868f4590f981d9917b685.json

  [ErrorException]
  zlib_decode(): data error

Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:388
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 zlib_decode() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:388
 Composer\Util\RemoteFilesystem->get() at phar:///usr/local/bin/composer/src/Composer/Util/RemoteFilesystem.php:101
 Composer\Util\RemoteFilesystem->getContents() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:646
 Composer\Repository\ComposerRepository->fetchFile() at phar:///usr/local/bin/composer/src/Composer/Repository/ComposerRepository.php:332
 Composer\Repository\ComposerRepository->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:204
 Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Pool.php:193
 Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:168
 Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php:322
 Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/local/bin/composer/src/Composer/DependencyResolver/Solver.php:214
 Composer\DependencyResolver\Solver->solve() at phar:///usr/local/bin/composer/src/Composer/Installer.php:461
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:216
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:174
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:24

I tried a lot of things, like disabling IPv6 and with different internet connections. And it fails on different packages, but always on the packagist.org host. All Github and other downloads succeed every time.

My internet connection is working fine, low pings and fast speeds (100Mb/s+) and tried different DNS servers and different providers, so this should not matter.

So it looks like trouble with the hosting of packagist.org

Anyone else has this same problem? And hopefully someone has a solution?

alcohol commented 7 years ago

This is an environment issue. Not packagist or composer related. Look through the existing (closed) issues on the composer repository for possible solutions (such as preferring ipv4 traffic over ipv6, or downgrading virtualbox to a specific version if you are using virtualbox, etc). It could also mean you have a bad firewall or proxy in your network.

casperbakker commented 7 years ago

I doubt that, because I read all those threads and tried every single thing. Plus I tried it in a lot of different environments, with different Vagrant/Virtualbox/Host OS/Guest OS/Connection/packages/etc.

But if no one having the same issues then I guess it is just bad luck.

Thanks for your comment though.

Rolice commented 7 years ago

I had the same issue yesterday in our office with composer under macOS Sierra. Today it was fine. However another team member, which works remotely have now the same issue under Windows.

We are working on the very same repository.

There is reference in the error about troubleshooting: https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode It helped me with protocol priority (at least yesterday):

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

This is however very strange fix, since complete disabling of IPv6 did not helped. This is possibly not exactly composer problem, but do we have any option to protect an installation from such issues?

Especially when we have automated deploy on production?

kcaporaso commented 7 years ago

@casperbakker , did you ever resolve your composer issue? I've been getting this for two days now and can't find the resolution. I've tried the ipv6 prededence trick, but it's not helping my Ubuntu 16.04 LTS VM hosted on macOS Sierra in VirtualBox. My internet is blazing fast even from the VM. If I manually try to grab one of the .json packgist files it blazes down - no clue why zlib_decode would have issues with the speed.

Downloading http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json
Downloading http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json
Downloading http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json

  [ErrorException]           
  zlib_decode(): data error  
 wget  http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json
--2016-11-10 15:39:51--  http://packagist.org/p/vich/uploader-bundle%24aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json
Resolving packagist.org (packagist.org)... 87.98.253.214, 2001:41d0:a:7b19::3
Connecting to packagist.org (packagist.org)|87.98.253.214|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 58334 (57K) [application/json]
Saving to: ‘uploader-bundle$aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json’

uploader-bundle$aa6bf9b2e7aef 100%[================================================>]  56.97K   255KB/s    in 0.2s    

2016-11-10 15:39:52 (255 KB/s) - ‘uploader-bundle$aa6bf9b2e7aefd47402f1c378df625938c1347b14451df0ddf1afc59b3954927.json’ saved [58334/58334]

Continuing to dive on this issue, will return should I find a solution for my specific situation.

kcaporaso commented 7 years ago

@casperbakker any chance you're using php 7

PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.3, Copyright (c) 1999-2016, by Zend Technologies
kcaporaso commented 7 years ago

There are things from over a year ago that helped some people, but I've tried all the solutions in this long thread and I'm still no good: https://github.com/composer/composer/issues/4121

Env. Host macOS Sierra, VirtualBox with Ubuntu 16.04. Have tried disabling all ipv6, tried forcing to ipv4 packagist, have tried straight source packagist, have self-updated after clearing composer cache plenty of times. Tried going back and forth between wifi and wired networks.

tejuprasad commented 7 years ago

I'm having this problem as well. I've tried everything on the very long thread mentioned above.

alcohol commented 7 years ago

VirtualBox is known to cause issue. See composer/composer#5814

tejuprasad commented 7 years ago

Thanks @alcohol. That fixed it.

casperbakker commented 7 years ago

I just kept trying, after a couple of hours it worked again. I indeed use php 7.

Great if it is fixed in VirtualBox. But I got the same thing on AWS.

Rolice commented 7 years ago

It appear that VirtualBox 5.1.18 has that problem, but 5.1.16 is fine.

psgganesh commented 7 years ago

Virtualbox 5.0.30 r112061 worked well in my case...

arrisar commented 7 years ago

@casperbakker Did you end up resolving your issue in AWS? Sorry for reviving a dead thread, but I'm experiencing the same issue in Ubuntu 16.04 on an EC2 t2.micro.

emilianotisato commented 7 years ago

@casperbakker, @Arrisar, and I am having this isue to in my Ubuntu laptop (no virtualbox).

If you have a clue it would be nice! Thanks

casperbakker commented 7 years ago

I got it sometimes for periods of 24 hours, and later is works again. Without any change on my side. As mentioned before in this thread, I am pretty convinced it is a hosting/server issue on packagist's side. But I have no concrete evidence for that.

I did not have this issue seen again in recent months.

hummerh2 commented 7 years ago

I am having the same issue. They appear to be working on the issue.

https://twitter.com/packagist?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor

"Our North American mirror for http://packagist.org is having some issues leading to Content-Length errors. We are aware and working on it"

antonioribeiro commented 7 years ago

I get this zlib_decode(): data error a lot from my workplace, but not from home. Related to a "connection reset by peer". The downloader code (file_get_contents()) is not checking if the file download was complete and then try to unzip (decode) a partially downloaded file, which generates this error.

A wget is sometimes able to download the file, here you can see it was able after a retry:

image

Sometimes it get stuck in a "Connection reset by peer" retry loop. But Composer's file_get_contents() does not "continue" a partially downloaded file, so it keeps getting that error.

The strangest thing about this is: downloading the very same file via Chrome works every time. So it might be the way the file is being requested from the server, maybe the browser agent?