CocoaPods / cocoapods-downloader

A small library that provides downloaders for various source types (HTTP/SVN/Git/Mercurial)
MIT License
84 stars 72 forks source link

CocoaPods hangs on unpacking boost 1.59 when executing pod install #69

Open yoelglus opened 7 years ago

yoelglus commented 7 years ago

See discussion here

yoelglus commented 7 years ago

Tried running the same commands: curl -f -L -o file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz and tar xfz file.tgz -C out Seems to work as expected. I also added a simple test to the http_spec.rb to extract the boost tar file but it took it 7-8s.

andon commented 7 years ago

Hi @yoelglus

I have an issue with this. When I ran pod install I get:

-> Installing boost (1.59.0)
 > Http download
   $ /usr/bin/curl -f -L -o /var/folders/3d/j7xmpxc13pb3ztl40vn3x2_00000gn/T/d20170925-21462-n3dqf4/file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
   --create-dirs --netrc-optional
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100   178  100   178    0     0    503      0 --:--:-- --:--:-- --:--:--   502
     0   355    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
   100  126k  100  126k    0     0  56841      0  0:00:02  0:00:02 --:--:--  500k
   $ /usr/bin/tar xfz /var/folders/3d/j7xmpxc13pb3ztl40vn3x2_00000gn/T/d20170925-21462-n3dqf4/file.tgz -C /var/folders/3d/j7xmpxc13pb3ztl40vn3x2_00000gn/T/d20170925-21462-n3dqf4
   tar: Unrecognized archive format
   tar: Error exit delayed from previous errors.

[!] Error installing boost
[!] /usr/bin/tar xfz /var/folders/3d/j7xmpxc13pb3ztl40vn3x2_00000gn/T/d20170925-21462-n3dqf4/file.tgz -C /var/folders/3d/j7xmpxc13pb3ztl40vn3x2_00000gn/T/d20170925-21462-n3dqf4

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

When I try to manually download the file like so (I've added -v at the end):

/usr/bin/curl -f -L -o file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz -v

I get the following output (cut some parts for clarity):

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 216.34.181.60...
* TCP_NODELAY set
* Connected to sourceforge.net (216.34.181.60) port 80 (#0)
> GET /projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz HTTP/1.1
> Host: sourceforge.net
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer:
>
< HTTP/1.1 301 Moved Permanently
< Server: nginx
< Date: Mon, 25 Sep 2017 20:11:53 GMT
< Content-Type: text/html
< Content-Length: 178
< Connection: keep-alive
< Location: https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
<
* Ignoring the response-body
{ [178 bytes data]
100   178  100   178    0     0    521      0 --:--:-- --:--:-- --:--:--   520
* Connection #0 to host sourceforge.net left intact
* Issue another request to this URL: 'https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz'
...
> GET /projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz HTTP/1.1
> Host: sourceforge.net
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
>
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0< HTTP/1.1 302 Found
< Server: nginx
< Date: Mon, 25 Sep 2017 20:11:54 GMT
< Content-Type: text/html; charset=UTF-8
< Content-Length: 15610
< Connection: close
< Pragma: no-cache
< Cache-Control: no-cache
< X-UA-Compatible: IE=edge,chrome=1
< X-Frame-Options: SAMEORIGIN
< Content-Security-Policy: upgrade-insecure-requests
...
* Closing connection 1
* Issue another request to this URL: 'https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download'
* Connection 0 seems to be dead!
* Closing connection 0
* Hostname sourceforge.net was found in DNS cache
*   Trying 216.34.181.60...
* TCP_NODELAY set
* Connected to sourceforge.net (216.34.181.60) port 443 (#2)
* SSL re-using session ID
...
> GET /projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz/download HTTP/1.1
> Host: sourceforge.net
> User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
> Accept: */*
> Referer: https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Mon, 25 Sep 2017 20:11:55 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 114760
< Connection: close
< Pragma: no-cache
< Cache-Control: no-cache
...
{ [99 bytes data]
100  112k  100  112k    0     0  40706      0  0:00:02  0:00:02 --:--:--  202k
* Closing connection 2

Seems that the returned response is the html page from sourceforge and not the requested binary.

yoelglus commented 7 years ago

hi @andon - I see the same when running curl but my pod install runs as expected...

andon commented 7 years ago

@yoelglus Can you run pod install in verbose mode? It should do the same as the curl cmd.

yoelglus commented 7 years ago

@andon - see bellow:

-> Installing boost (1.59.0)
 > Http download
   $ /usr/bin/curl -f -L -o /var/folders/jt/xszc8h512l1fvvghn02kd41rf00bxx/T/d20170930-94356-hcyz5b/file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz --create-dirs --netrc-optional
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100   178  100   178    0     0    539      0 --:--:-- --:--:-- --:--:--   539
     0   355    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
     0   431    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
     0   345    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
   100 79.8M  100 79.8M    0     0   674k      0  0:02:01  0:02:01 --:--:--  602k
   $ /usr/bin/tar xfz /var/folders/jt/xszc8h512l1fvvghn02kd41rf00bxx/T/d20170930-94356-hcyz5b/file.tgz -C /var/folders/jt/xszc8h512l1fvvghn02kd41rf00bxx/T/d20170930-94356-hcyz5b
yoelglus commented 7 years ago

Some network latency but the thing that really takes a long time is the tar command...

andon commented 7 years ago

Strange. Latency and size were not the issue on my side, but the redirects from sourceforge.net. Anyway, as a workaround I use a podspec that points to a different URL for downloading it.

yoelglus commented 7 years ago

yep, we will do the same probably...

MPiccinato commented 7 years ago

Just came across this same issue when installing React Native dependencies. I can run the curl command no problem but CocoaPods just hangs on /usr/bin/tar xfz /var/folders/6m/l15crj8s3g938fh1hky8n9q80000gn/T/d20171001-8272-uapq6q/file.tgz -C /var/folders/6m/l15crj8s3g938fh1hky8n9q80000gn/T/d20171001-8272-uapq6q.

When I check the folder it looks like everything unpacked fine but CocoaPods is unsure what to do next?

irace commented 7 years ago

@andon @yoelglus What URL did you end up using?

andon commented 7 years ago

@irace https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz from https://github.com/react-native-community/boost-for-react-native

yoelglus commented 7 years ago

@irace - I kept it as it is (same one as in the first comments)

bartdorsey commented 7 years ago

I'm new to cocoa pods and I'm having this issue while using a react native app. @andon how do you go about using this custom url in a pod spec? I've been trying to digest documentation and figure it out, but I'm not having much luck.

stefanengel commented 7 years ago

We have experienced the same problem every now and then on different machines. Downloading boost does not seem to be a problem, but after that Ruby uses up all CPU for about 10 minutes, then the installation succeeds.

lakhman commented 6 years ago

I had this same error, the spec download url points to a sourceforge page with a redirect, and that redirect is where it fails.

[!] Error installing boost

126k 0 0 45312 0 0:00:02 0:00:02 --:--:-- 101k $ /usr/bin/tar xfz /var/folders/path/file.tgz -C /var/folders/path tar: Unrecognized archive format tar: Error exit delayed from previous errors.

[!] Error installing boost [!] /usr/bin/tar xfz /var/folders/path/file.tgz -C /var/folders/path

Quick Fix

Find this file on your system and edit it's source url.

https://github.com/CocoaPods/Specs/blob/d0ec5a65e80656c8d78e12ff19f251df879e0bc2/Specs/9/9/d/boost/1.59.0/boost.podspec.json

Find the boost spec file locally

open ~/.cocoapods/repos/master/Specs/9/9/d/boost/1.59.0/boost.podspec.json

Change the source download url to a direct link

  "source": {
    "http": "https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=&ts=1513105136&use_mirror=kent"
  },

Pod install with patience

# everything should work - boost can be downloaded and unpacks
# Note this takes a while to compile, be patient.
pod install
Pranit-Harekar commented 6 years ago

How to achieve this on travis ??

Epsiloni commented 6 years ago

To build upon @lakhman's answer, what solved this for me was to go to the SourceForge page here and get the link it provides for you when you click the boost_1_59_0.tar.gz file (or simply click here). You can get it by right clicking the "direct link" link they have and press "copy link". Then paste it into the source like @lakhman showed above. and run pod install.

Be prepared, it takes forever.

vovkasm commented 6 years ago

If it can help someone to detect the bottleneck, I run sampler (from Monitor.app) while wait that process to complete. On screen:

> pod install --verbose
...
-> Installing boost (1.59.0)
 > Http download
   $ /usr/bin/curl -f -L -o /var/folders/mm/c6dmpcvs5qz89rdd_v0hfm8w0000gn/T/d20180102-25086-1otwbdt/file.tgz http://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz --create-dirs --netrc-optional
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
   100   178  100   178    0     0    576      0 --:--:-- --:--:-- --:--:--   577
     0   355    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
     0   431    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
     0   345    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
   100 79.8M  100 79.8M    0     0  1192k      0  0:01:08  0:01:08 --:--:-- 3639k
   $ /usr/bin/tar xfz /var/folders/mm/c6dmpcvs5qz89rdd_v0hfm8w0000gn/T/d20180102-25086-1otwbdt/file.tgz -C /var/folders/mm/c6dmpcvs5qz89rdd_v0hfm8w0000gn/T/d20180102-25086-1otwbdt

Sampler results: https://gist.github.com/vovkasm/613107727d86ae12384865113ab97d93

itinance commented 6 years ago

Any news on this? I've found out that the root cause is indeed an invalid tar.gz file for boost that only contains plain html code.

Pls find more info here: https://github.com/CocoaPods/CocoaPods/issues/4830#issuecomment-355219321

rghorbani commented 6 years ago

I did a test and disabling cocoapods cache solves that issue. digging around I've saw that it extracts boost to the cache directory ~500MB of data and then it has another copy to do into the target directory, all that copies takes a loot of time and makes it look like it hangs.

You can disable it by creating a ~/.cocoapods/config.yaml file with the following contents.

skip_download_cache: true

Young-Je commented 6 years ago

change the source at https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz and save the spec file. issue gone. contact me via youngjexu@icloud.com, if you want further explanation.

enijar commented 6 years ago

I had the following error.

[!] Error installing boost
[!] /usr/local/php5/bin/curl -f -L -o /var/folders/bk/qnj768gj3lzd3l10fpv646_80000gp/T/d20180328-76160-oa20vt/file.tgz https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=&ts=1513105136&use_mirror=kent --create-dirs --netrc-optional

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (35) Unknown SSL protocol error in connection to downloads.sourceforge.net:443

Open ~/.cocoapods/repos/master/Specs/9/9/d/boost/1.59.0/boost.podspec.json

Change the URL from this

"source": {
    "http": "https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=&ts=1513105136&use_mirror=kent"
  }

to this

"source": {
    "http": "http://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz?r=&ts=1513105136&use_mirror=kent"
  }
khiami commented 6 years ago

Updating the download link: https://jaist.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz

It took 29 seconds for download but around 3 minutes to unpack the file :(

sospedra commented 6 years ago

It's really funny that this is happening with a pod called boost

GuoZhiQiang commented 4 years ago

Thanks @lakhman . Or open ~/.cocoapods/repos/cocoapods/Specs/9/9/d/boost/1.59.0/boost.podspec.json

bogdanbolchis commented 2 years ago

After constantly having this problem, i put skip_download_cache: true in ~/.cocoapods/config.yml (didn't work), then in ~/.cocoapods/config.yaml which appears to work (no cached stuff at ~/Library/Caches/CocoaPods). No hanged install anymore.

vanjaoljaca commented 1 year ago

I'm having this issue today:

-> Installing boost (1.76.0)
 > Http download
   $ /usr/bin/curl -f -L -o /var/folders/y4/pjc9r3q93x54jhkyv5cs720h0000gn/T/d20230124-35212-kph6qw/file.tbz https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 --create-dirs
   --netrc-optional --retry 2 -A 'CocoaPods/1.11.3 cocoapods-downloader/1.6.3'
     % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                    Dload  Upload   Total   Spent    Left  Speed
     0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
   100  104M  100  104M    0     0  14.1M      0  0:00:07  0:00:07 --:--:-- 16.0M
   $ /usr/bin/tar xf /var/folders/y4/pjc9r3q93x54jhkyv5cs720h0000gn/T/d20230124-35212-kph6qw/file.tbz -C /var/folders/y4/pjc9r3q93x54jhkyv5cs720h0000gn/T/d20230124-35212-kph6qw
  > Copying boost from `/Users/voljaca/Library/Caches/CocoaPods/Pods/External/boost/909665deed38b6f25051fac8c534aa3c-a7c83` to `Pods/boost`

Seems stuck.

~/.cocoapods/repos/master//boost//boost.podspec.json does not exist, and neither does it exist in ~/.cocoapods/repos/trunk/...

Any advice?

edit: it eventually finished on its own

dccabao commented 11 months ago

What is the fix sorry?

andres-dos-santos commented 9 months ago

I used @rghorbani's tip and then ran pod install --verbose and I was able to see that it weighs 104mb and takes a while to download.

My internet is good but the download is slow anyway. I do not know the reason.

Kelier commented 8 months ago

still