Skip to content
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

Using Composer with network connection problems pollutes the cache #10028

Closed
joachim-n opened this issue Jul 28, 2021 · 4 comments
Closed

Using Composer with network connection problems pollutes the cache #10028

joachim-n opened this issue Jul 28, 2021 · 4 comments
Labels
Milestone

Comments

@joachim-n
Copy link

joachim-n commented Jul 28, 2021

Composer version: 2.0.3

I was trying to do composer install while on a train, and it produced this output with multiple packages, which I assume are the ones which were not in my local cache:

  - Installing symfony/phpunit-bridge (v5.3.4): Extracting archive
  10/110 [==>-------------------------]   9%    Failed to extract fabpot/goutte: (9) '/usr/bin/unzip' -qq '/Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-58e741e64aa2c99bf8057ecca317a1c0' -d '/Users/joachim/Sites/drupal-plain-clone/vendor/composer/3536e130'

[/Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-58e741e64aa2c99bf8057ecca317a1c0]
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-58e741e64aa2c99bf8057ecca317a1c0 or
        /Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-58e741e64aa2c99bf8057ecca317a1c0.zip, and cannot find /Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-58e741e64aa2c99bf8057ecca317a1c0.ZIP, period.

    The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
    Unzip with unzip command failed, falling back to ZipArchive class

It eventually failed with this:

  [UnexpectedValueException]
  '/Users/joachim/Sites/drupal-plain-clone/vendor/composer/tmp-d9bf75a5773a2fda5888ae90e27c8cc8' is not a zip
   archive.

When I was back home, I removed the /vendor folder from my project, and tried to do composer install from scratch.

This produced the same errors.

The problem was only fixed once I did composer clear-cache.

My theory is that because I was on the train's wifi, Composer either wasn't able to reach the package servers at all, or hit a 'log in to wifi' type thing instead.

I would expect Composer to fail, but not put bad data into its cache.

@Seldaek Seldaek added the Bug label Jul 28, 2021
@Seldaek Seldaek added this to the 2.1 milestone Jul 28, 2021
@Seldaek
Copy link
Member

Seldaek commented Aug 17, 2021

Hmm.. I can't reproduce this even if I cut the file in half here just before it gets written to cache after assuming a successful download

I do get everything behaving like you say, but then the cached file gets cleared by

and
$self->clearLastCacheWrite($package);

So I am not entirely sure how you ended up in a bad state.

@joachim-n
Copy link
Author

Hmm.. I can't reproduce this even if I cut the file in half here just before it gets written to cache after assuming a successful download

I don't think there was even a successful download. I suspect the HTTP requests got intercepted by the train wifi's login system and so the downloader got some sort of HTML back instead of a zip file.

@Seldaek
Copy link
Member

Seldaek commented Aug 17, 2021

Yeah but that would probably pass for a 200, making composer it got a valid archive, that's why I truncated the file there, to simulate a 200-yet-corrupt download

@Seldaek
Copy link
Member

Seldaek commented Aug 17, 2021

Anyway I can reproduce by corrupting the cache on purpose, so I'll try to fix things so it doesn't get stuck with a bad cache, but it's weird that you got into this state in the first place.

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

No branches or pull requests

2 participants