Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Failing 'Generate Drupal project with composer package' - Content-Length mismatch #941

Closed
wturrell opened this issue Oct 25, 2016 · 15 comments
Labels

Comments

@wturrell
Copy link

It seems to choke on a specific download from http://cgit.drupalcode.org:

http://cgit.drupalcode.org/drupal/plain/sites/default/default.services.yml?h=8.2.1

However I can wget that file and it looks OK, if that's where the error is. I don't see anything immediately "wrong" with the composer.json / installed.json files mentioned afterwards.

As a massive block of JSON is hard to read I logged into the VM with vagrant ssh and ran the command by hand…

vagrant@drupalvm:/var/www/drupalvm$ /usr/bin/composer create-project drupal-composer/drupal-project:8.x-dev /var/www/drupalvm/drupal --prefer-dist --stability dev --no-interaction
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Installing drupal-composer/drupal-project (8.x-dev f6099e3597d82691e16364ab5a5b7edd05d8bf5c)
  - Installing drupal-composer/drupal-project (8.x-dev f6099e3)
    Loading from cache

Created project in /var/www/drupalvm/drupal
    1/1:    https://packages.drupal.org/8/drupal/provider-2016-3$b22a3a8a89180b50559f692a10d96bb7aab0d67bef9e6f6f1803270634550051.json
    Finished: success: 1, skipped: 0, failure: 0, total: 1
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing drupal-composer/drupal-scaffold (2.1.0)
    Loading from cache

[...]

All the packages symphony, drupal, phpunit etc. are then installed from the cache
This next bit was run with -vvv on (i.e. maximum verbosity so you can tell what files it's downloading…

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component, for optionally caching feeds between requests)
zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component, for use with PubSubHubbub)
zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)
zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for easily extending ExtensionManager implementations)
zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
symfony/validator suggests installing symfony/intl ()
symfony/validator suggests installing symfony/property-access (For using the 2.4 Validator API)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.)
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
alchemy/zippy suggests installing ext-zip (To use the ZipExtensionAdapter)
alchemy/zippy suggests installing guzzle/guzzle (To use the GuzzleTeleporter)
behat/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Reading /var/www/drupalvm/drupal/vendor/composer/installed.json
Writing lock file
Generating autoload files
Downloading http://cgit.drupalcode.org/drupal/plain/.csslintrc?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.editorconfig?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.eslintignore?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.eslintrc?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.gitattributes?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.htaccess?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/index.php?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/robots.txt?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/sites/default/default.settings.php?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/sites/default/default.services.yml?h=8.2.1
    Downloading: 0%Reading ./composer.json
Loading config file ./composer.json
Reading /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/composer.json
Reading /var/www/drupalvm/drupal/vendor/composer/installed.json

  [Composer\Downloader\TransportException]
  Content-Length mismatch

Exception trace:
 () at phar:///usr/bin/composer/src/Composer/Util/RemoteFilesystem.php:294
 Composer\Util\RemoteFilesystem->get() at phar:///usr/bin/composer/src/Composer/Util/RemoteFilesystem.php:86
 Composer\Util\RemoteFilesystem->copy() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/FileFetcher.php:35
 DrupalComposer\DrupalScaffold\FileFetcher->DrupalComposer\DrupalScaffold\{closure}() at n/a:n/a
 array_walk() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/FileFetcher.php:36
 DrupalComposer\DrupalScaffold\FileFetcher->fetch() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Handler.php:120
 DrupalComposer\DrupalScaffold\Handler->downloadScaffold() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Handler.php:91
 DrupalComposer\DrupalScaffold\Handler->onPostCmdEvent() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Plugin.php:66
 DrupalComposer\DrupalScaffold\Plugin->postCmd() at n/a:n/a
 call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:170
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:95
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/bin/composer/src/Composer/Installer.php:297
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/CreateProjectCommand.php:188
 Composer\Command\CreateProjectCommand->installProject() at phar:///usr/bin/composer/src/Composer/Command/CreateProjectCommand.php:142
 Composer\Command\CreateProjectCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:43
 require() at /usr/bin/composer:24

NB: sometimes I get a different percentage, e.g. 55%.

Host system:

  • macOS 10.11.6 (El Capitan)
  • vagrant 1.8.6
  • ansible 2.1.2.0
  • VirtualBox 5.0.28
wt$ diff default.config.yml config.yml
26c26
<   - local_path: .

---
>   - local_path: /Users/wt/Dropbox/drupalvm
36c36
< drupalvm_vagrant_version_min: '1.8.5'

---
> drupalvm_vagrant_version_min: '1.8.6'
198c198
<   # - memcached

---
>   - memcached
206c206
<   - varnish

---
>   # - varnish
@lqbombjack
Copy link

Having an issue in a similar block of the composer install:

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component, for optionally caching feeds between requests)
zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component, for use with PubSubHubbub)
zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)
zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for easily extending ExtensionManager implementations)
zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component, for validating email addresses used in Atom feeds and entries ehen using the Writer subcomponent)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
symfony/validator suggests installing symfony/intl ()
symfony/validator suggests installing symfony/property-access (For using the 2.4 Validator API)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
symfony/var-dumper suggests installing ext-symfony_debug ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.)
phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.)
phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.)
alchemy/zippy suggests installing ext-zip (To use the ZipExtensionAdapter)
alchemy/zippy suggests installing guzzle/guzzle (To use the GuzzleTeleporter)
behat/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Reading /var/www/drupalvm/drupal/vendor/composer/installed.json
Writing lock file
Generating autoload files
Downloading http://cgit.drupalcode.org/drupal/plain/.csslintrc?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.editorconfig?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.eslintignore?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.eslintrc?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.gitattributes?h=8.2.1
    Downloading: 100%
Downloading http://cgit.drupalcode.org/drupal/plain/.htaccess?h=8.2.1
    Downloading: 85%Reading ./composer.json
Loading config file ./composer.json
Reading /home/vagrant/.composer/composer.json
Loading config file /home/vagrant/.composer/composer.json
Reading /var/www/drupalvm/drupal/vendor/composer/installed.json


  [Composer\Downloader\TransportException]
  Content-Length mismatch


Exception trace:
 () at phar:///usr/bin/composer/src/Composer/Util/RemoteFilesystem.php:294
 Composer\Util\RemoteFilesystem->get() at phar:///usr/bin/composer/src/Composer/Util/RemoteFilesystem.php:86
 Composer\Util\RemoteFilesystem->copy() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/FileFetcher.php:35
 DrupalComposer\DrupalScaffold\FileFetcher->DrupalComposer\DrupalScaffold\{closure}() at n/a:n/a
 array_walk() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/FileFetcher.php:36
 DrupalComposer\DrupalScaffold\FileFetcher->fetch() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Handler.php:120
 DrupalComposer\DrupalScaffold\Handler->downloadScaffold() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Handler.php:91
 DrupalComposer\DrupalScaffold\Handler->onPostCmdEvent() at /var/www/drupalvm/drupal/vendor/drupal-composer/drupal-scaffold/src/Plugin.php:66
 DrupalComposer\DrupalScaffold\Plugin->postCmd() at n/a:n/a
 call_user_func() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:170
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:95
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/bin/composer/src/Composer/Installer.php:297
 Composer\Installer->run() at phar:///usr/bin/composer/src/Composer/Command/CreateProjectCommand.php:188
 Composer\Command\CreateProjectCommand->installProject() at phar:///usr/bin/composer/src/Composer/Command/CreateProjectCommand.php:142
 Composer\Command\CreateProjectCommand->execute() at phar:///usr/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:847
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///usr/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/bin/composer/bin/composer:43
 require() at /usr/bin/composer:24

Different file to the OP, but always stops at 85%.

I can load this .htaccess file in my browser with no issue.

I'm pretty new to using composer, is there a way to dig deeper into why it's getting a mismatch on the file size?

I've also tried the following over ssh:

  • updating composer
  • running: /usr/bin/composer create-project drupal-composer/drupal-project:8.x-dev /var/www/drupalvm/drupal --prefer-dist -vvv
    (Nothing interactive came up with regards the mismatch, it just failed as before)

Host system:
Win7 :-(
vagrant 1.8.5
ansible 2.1.2.0
VirtualBox 5.0.28

config.yml is unchanged from the default except for shared folder mapping details.

@wturrell
Copy link
Author

wturrell commented Oct 26, 2016

  • I've tested the same composer command on the host Mac and it completes successfully.
  • I've also successfully tested the 7.x branch of drupal-composer/drupal-project on the VM itself – but obviously the composer.json for Drupal 7 is rather different.
  • I've cleared the composer cache.

For the record, earlier it did once fail for me on the .htaccess file too, but has since reverted to default.services.yml

(Edit: also, I've added debugging to the Vagrantfile to verify the playbook is running on the host rather than the guest, i.e. ansible not ansible_local provisioning.)

@geerlingguy
Copy link
Owner

Is this still happening? It seems like it might be something temporary, but I haven't had a chance to do some testing today. You are using the default config with 8.x and it's failing there, correct?

@geerlingguy
Copy link
Owner

Also, it might help to use Vagrant 1.8.5... there have been a number of small/weird issues with 1.8.6 and I haven't fully tested with 1.8.6 myself yet.

@wturrell
Copy link
Author

@geerlingguy yes, still happening. I rolled back to Vagrant 1.8.5 and tested the default 8.x config again.

@geerlingguy
Copy link
Owner

I've rebuilt the VM on three separate machines today (two Macs, Sierra 10.12 and 10.12.1, and Win 10), with Vagrant 1.8.5 and 1.8.6, and can't replicate the issue.

If you try again today, is it still happening? This sounds like a network/routing issue...

@wturrell
Copy link
Author

Just tested now, still failing. (however I will attempt it shortly on a different Mac and update you.)

@wturrell
Copy link
Author

I'm thinking this may be a server problem. I've opened an issue in the Drupal Infrastructure queue and I've written this PHP test script which loops through the various files.

@wturrell
Copy link
Author

wturrell commented Nov 2, 2016

@geerlingguy see my latest comment on drupal.org (could it be anything to do with your vagrant_box?)

@oxyc
Copy link
Collaborator

oxyc commented Nov 22, 2016

For reference (from the drupal.org issue queue):

Everything appears to work perfectly on VirtualBox 5.1.6 - i.e. I can complete the entire playbook using geerlingguy/ubuntu1604 (virtualbox, 1.0.4).
Note I've only run it the once – however on any empty ubuntu/trusty64 box, my PHP script downloads those files consistently without error on 5.1.6 and is failing on 5.1.8. This is all with Vagrant 1.8.5. Note also when this first began I was using VirtualBox 5.0.28.

@kmcgill88
Copy link

@oxyc - @wturrell I just updated my Virtual box from 5.1.8 to 5.1.10 and using Vagrant 1.8.7.

Failed:
Vagrant 1.8.5 with Virtual Box 5.1.8
Vagrant 1.8.7 with Virtual Box 5.1.8

Works:
Vagrant 1.8.7 with Virtual Box 5.1.10

@geerlingguy
Copy link
Owner

Woot, glad 5.1.10 is working! Finally fixed the networking bug that cropped up in 5.1.8.

@geerlingguy
Copy link
Owner

I'm going to optimistically close this out, and redirect people still having issues to #981, and to make sure they have VirtualBox 5.1.10.

@wturrell
Copy link
Author

@kmcgill88 can also confirm it works with Vagrant 1.8.7 and VirtualBox 5.1.10 (macOS 10.11.6)

@kmcgill88
Copy link

@geerlingguy @wturrell for me worked on

Vagrant 1.8.7 with Virtual Box 5.1.10 (macOS 10.12.1)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants