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

[bug] file DOWNLOAD cannot compute hash on failed download, it shows 'status: [35;"SSL connect error"]' #16302

Open
chenyongquan2 opened this issue May 18, 2024 · 16 comments
Assignees

Comments

@chenyongquan2
Copy link

chenyongquan2 commented May 18, 2024

Problem Description

When using Conan to build my application, I'm encountering the following error:

-- Conan: Including build module from 'C:/Users/cyq/.conan2/p/b/opense3373fbcf617d/p/lib/cmake/conan-official-openssl-variables.cmake'
-- Downloading from https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz, if failed, please try configuring again
CMake Error at cmake/download_archive.cmake:25 (file):
  file DOWNLOAD cannot compute hash on failed download

    status: [35;"SSL connect error"]
Call Stack (most recent call first):
  CMakeLists.txt:379 (download_archive)


-- Downloading from https://github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz, if failed, please try configuring again
-- Configuring incomplete, errors occurred!

grpc/1.54.3: ERROR:
Package 'c5a491e7c91a9fa26a0f5fec86c1d1e1322ee2e4' build failed
grpc/1.54.3: WARN: Build folder C:\Users\cyq\.conan2\p\b\grpcbeda44cad0f13\b\build
ERROR: grpc/1.54.3: Error in build() method, line 210
        cmake.configure()
        ConanException: Error 1 while executing
error: @programdir\core\sandbox\modules\os.lua:378: execv(conan install . -g XmakeGenerator --profile:build=profile_build.txt --profile:host=profile_host.txt --build=missing) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [@programdir\core\sandbox\modules\os.lua:378]:
    [@programdir\core\sandbox\modules\os.lua:291]: in function 'vrunv'
    [...dir\modules\package\manager\conan\v2\install_package.lua:331]:
    [...ramdir\modules\package\manager\conan\install_package.lua:41]:
    [@programdir\modules\package\manager\install_package.lua:111]:
    [@programdir\core\package\package.lua:2765]: in function 'script'
    [...dir\modules\private\action\require\impl\utils\filter.lua:114]: in function 'call'
    [...\modules\private\action\require\impl\actions\install.lua:342]:

  => install conan::etcd-cpp-apiv3/0.15.4 latest .. failed
error: @programdir\core\main.lua:306: @programdir\modules\async\runjobs.lua:320: ...\modules\private\action\require\impl\actions\install.lua:474: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir\core\base\os.lua:957]:
    [...\modules\private\action\require\impl\actions\install.lua:474]: in function 'catch'
    [@programdir\core\sandbox\modules\try.lua:123]: in function 'try'
    [...\modules\private\action\require\impl\actions\install.lua:333]:
    [...modules\private\action\require\impl\install_packages.lua:479]: in function 'jobfunc'
    [@programdir\modules\async\runjobs.lua:237]:

stack traceback:
        [C]: in function 'error'
        @programdir\core\base\os.lua:957: in function 'os.raiselevel'
        (...tail calls...)
        @programdir\core\main.lua:306: in upvalue 'cotask'
        @programdir\core\base\scheduler.lua:404: in function <@programdir\core\base\scheduler.lua:397>

Environment Information

  • Conan version: 2.3.0
  • Operating System: Windows 11
  • CMake: 3.28.1

Additional Information

I've tried the following approaches, but the issue persists:

Checked the network connection for any issues.
1.Configured Conan to use a proxy server, as required for my network setup.
image
2.Utilized a VPN to bypass the network policy restrictions in China.
3. Directly accessed the download URL https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz in the browser, and was able to successfully download the tarball file.
image

If you have any other suggestions, please let me know. Thank you!

@memsharded
Copy link
Member

It could be that your IT uses different configuration for browser requests, and might be blocking other non-browser requests.

Can you try the same for example at home, and see if it works?

@chenyongquan2
Copy link
Author

It could be that your IT uses different configuration for browser requests, and might be blocking other non-browser requests.可能是您的 IT 部门对浏览器请求使用了不同的配置,可能会阻止其他非浏览器请求。

Can you try the same for example at home, and see if it works?例如,您可以在家里尝试同样的方法,看看是否有效?
Hi @memsharded, I had previously tried this example at home, and the error message is as shown above.

@memsharded
Copy link
Member

Hi @memsharded, I had previously tried this example at home, and the error message is as shown above.

Sorry, just to make sure: did you try at home with the same computer, or with a different computer and outside of the corporate network? Because if you are at home with the same corporate laptop, probably connected to the office VPN, then, it would be identical to being in the office physically.

I am trying to isolate the possible issue, if it could be the VPN, the proxy, or it could be other thing.

@chenyongquan2
Copy link
Author

Hi @memsharded, I had previously tried this example at home, and the error message is as shown above.嗨 ,我之前在家里试过这个例子,错误信息如上图所示。

Sorry, just to make sure: did you try at home with the same computer, or with a different computer and outside of the corporate network? Because if you are at home with the same corporate laptop, probably connected to the office VPN, then, it would be identical to being in the office physically.对不起,我只是想确认一下:你是在家里用同一台电脑试的,还是在公司网络外用另一台电脑试的?因为如果你在家里使用的是公司的同一台笔记本电脑,可能还连接了办公室的 VPN,那么,这就和在办公室里的情况完全一样了。

I am trying to isolate the possible issue, if it could be the VPN, the proxy, or it could be other thing.我正试图找出可能的问题,是 VPN 的问题,还是代理的问题,或者是其他原因。

Hi @memsharded Thank you very much for your explanation and questions. I have been using my personal laptop at home to try it out, and my network environment is a non-corporate one. It is my home broadband, and I use a VPN to access GitHub (due to China's network policies that restrict access to GitHub without a VPN). The VPN I use is not a corporate VPN.

@memsharded
Copy link
Member

If at home you have exactly the same issue, then I'd say that it seems the problem is the VPN might be filtering the Conan User-Agent or something like that, and allowing only the browser user agents, that could explain the issue?

Can you please try doing a download of that url with the Python request library?

import requests


url = 'https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz'
r = requests.get(url, allow_redirects=True)

open('myfile.tar.gz', 'wb').write(r.content)

@chenyongquan2
Copy link
Author

If at home you have exactly the same issue, then I'd say that it seems the problem is the VPN might be filtering the Conan User-Agent or something like that, and allowing only the browser user agents, that could explain the issue?如果您在家中遇到了完全相同的问题,那么我认为问题可能出在 VPN 上,VPN 可能过滤了柯南 User-Agent 或类似的内容,只允许使用浏览器用户代理,这就能解释问题所在了吗?

Can you please try doing a download of that url with the Python request library?您能否尝试使用 Python request 库下载该网址?

import requests


url = 'https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz'
r = requests.get(url, allow_redirects=True)

open('myfile.tar.gz', 'wb').write(r.content)

Sure, @memsharded
the python library works ok:
image

@memsharded
Copy link
Member

Ok, that is at least a step forward.
To check if the user agent could be the issue:

import requests
import platform


url = 'https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz'

platform_info = "; ".join([" ".join([platform.system(), platform.release()]),
                          "Python "+platform.python_version(),
                          platform.machine()])
headers = {"User-Agent": f"Conan/2.3.1 ({platform_info})"}
r = requests.get(url, allow_redirects=True, headers=headers)

open('myfile.tar.gz', 'wb').write(r.content)

@chenyongquan2
Copy link
Author

chenyongquan2 commented May 24, 2024

Hi @memsharded
It also works ok
image

@memsharded
Copy link
Member

I am really confused about this, I don't know what to think.

Have you tried to use Conan directly? I mean, it seems that you are calling it via xmake from the traces above, but have you tried calling?:

conan version
conan install --requires=grpc/1.54.3 --build=missing

Just in case running from xmake could have some effect.

@chenyongquan2
Copy link
Author

I am really confused about this, I don't know what to think.我真的很困惑,不知道该怎么想。

Have you tried to use Conan directly? I mean, it seems that you are calling it via xmake from the traces above, but have you tried calling?:你试过直接使用柯南吗?我的意思是,从上面的痕迹来看,你是通过 xmake 调用它的,但你有没有试过直接调用?

conan version
conan install --requires=grpc/1.54.3 --build=missing

Just in case running from xmake could have some effect.以防从 xmake 运行会产生影响。

Hi @memsharded
I Have tried

conan install --requires=grpc/1.54.3 --build=missing --profile:build=profile_build.txt --profile:host=profile_host.txt

or

conan install --requires=etcd-cpp-apiv3/0.15.4 --build=missing --profile:build=profile_build.txt --profile:host=profile_host.txt

But it still failed:
image
And more info about the profile_build.txt and profile_host.txt :
image
image

@memsharded
Copy link
Member

I have just realized something, this doesn't seem to be a Conan download. It is not Conan that is downloading anything, it seems to be the CMakeLists.txt that is downloading that file, here: https://github.com/grpc/grpc/blob/1309eb283c3e11c471191f286ceab01b75477ffc/CMakeLists.txt#L432

If it is CMake doing the download, not Conan, it doesn't matter what configuration (proxies, certs, etc) you pass to Conan, because it is not being used. To verify if CMake is the culprit, you might extract those lines to an independent CMakeLists.txt and execute it with just cmake and see what happens.

@chenyongquan2
Copy link
Author

chenyongquan2 commented Jun 9, 2024

I have just realized something, this doesn't seem to be a Conan download. It is not Conan that is downloading anything, it seems to be the CMakeLists.txt that is downloading that file, here: https://github.com/grpc/grpc/blob/1309eb283c3e11c471191f286ceab01b75477ffc/CMakeLists.txt#L432我刚刚意识到一件事,这似乎不是柯南的下载。下载文件的不是柯南,似乎是 CMakeLists.txt 在下载该文件,网址是:https://github.com/grpc/grpc/blob/1309eb283c3e11c471191f286ceab01b75477ffc/CMakeLists.txt#L432。

If it is CMake doing the download, not Conan, it doesn't matter what configuration (proxies, certs, etc) you pass to Conan, because it is not being used. To verify if CMake is the culprit, you might extract those lines to an independent CMakeLists.txt and execute it with just cmake and see what happens.如果是 CMake 而不是 Conan 在进行下载,那么传给 Conan 的配置(代理、证书等)就无关紧要了,因为它并没有被使用。要验证 CMake 是否是罪魁祸首,你可以将这些行提取到一个独立的 CMakeLists.txt 中,然后只用 cmake 执行,看看会发生什么。

@memsharded
Thank you very much for your response. I just tried downloading using only the CMakeLists.txt:

cmake_minimum_required(VERSION 3.0.0)

# 定义下载 URL 和预期的 SHA256 校验和
# set(DOWNLOAD_URL "https://github.com/cncf/xds/archive/3a472e524827f72d1ad621c4983dd5af54c46776.tar.gz")
# set(EXPECTED_SHA256 "dc305e20c9fa80822322271b50aa2ffa917bf4fd3973bcec52bfc28dc32c5927")
set(DOWNLOAD_URL "https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz")
set(EXPECTED_SHA256 "b7e13f0b4259e80c3070b583c2f39e53153085a6918718b1c710caf7037572b0")

# 创建一个临时文件用于下载
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/downloads")
# set(DOWNLOAD_FILE "${CMAKE_BINARY_DIR}/downloads/xds.tar.gz")
set(DOWNLOAD_FILE "${CMAKE_BINARY_DIR}/downloads/v0.3.0.tar.gz")


# 执行下载操作
file(DOWNLOAD "${DOWNLOAD_URL}" "${DOWNLOAD_FILE}"
     SHOW_PROGRESS
     EXPECTED_HASH SHA256=${EXPECTED_SHA256})

# 输出下载结果
if(EXISTS "${DOWNLOAD_FILE}")
  message(STATUS "Download successful: ${DOWNLOAD_FILE}")
else()
  message(FATAL_ERROR "Download failed")
endif()

and the result was:

cyq@DESKTOP-0LR5H32 MINGW64 /c/workspace/cmake_pratice/first_template/build (main)
$ cmake ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Error at CMakeLists.txt:16 (file):
  file DOWNLOAD cannot compute hash on failed download

    status: [35;"SSL connect error"]


-- Download successful: C:/workspace/cmake_pratice/first_template/build/downloads/v0.3.0.tar.gz
-- Configuring incomplete, errors occurred!

But I didn't have any idea about this error.

@chenyongquan2
Copy link
Author

I have try to download by the curl, and it failed either:

C:\Users\cyq>curl -L --verbose  -o v0.3.0.tar.gz https://storage.googleapis.com/grpc-bazel-mirror/github.com/census-instrumentation/opencensus-proto/archive/v0.3.0.tar.gz
  % 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 142.251.42.251:443...
*   Trying [2404:6800:4012:4::201b]:443...
* Connected to storage.googleapis.com (142.251.42.251) port 443
* schannel: disabled automatic use of client certificate
* ALPN: curl offers http/1.1
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Recv failure: Connection was reset
* schannel: failed to receive handshake, SSL/TLS connection failed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection
* schannel: shutting down SSL/TLS connection with storage.googleapis.com port 443
* Send failure: Connection was reset
* schannel: failed to send close msg: Failed sending data to the peer (bytes written: -1)
curl: (35) Recv failure: Connection was reset

But I am still puzzled by the fact that the browser is able to download the file normally.

@memsharded memsharded self-assigned this Jun 9, 2024
@memsharded
Copy link
Member

The reasons why a browser might have access but other applications not, is because browsers might use different User-Agent, might have different certificates installed, etc.

To summarize: This seems to confirm that it is not a Conan issue, but a network limitation issue on the user side, so this wouldn't be a Conan bug. I am afraid that we cannot do anything from the Conan side to solve it directly. What you can do is something like:

  • Download the tgz files you want, put them in your own server (like ArtifactoryCE running in your network)
  • Fork conan-center-index, change the conandata.yml to point them to your own copy of your tgz in your server
  • Create packages from conan-center-index fork.

@chenyongquan2
Copy link
Author

Can I manually download this tgz file and then copy it to a specific Conan directory, so that gRPC can be compiled successfully?

@memsharded
Copy link
Member

Yes, the file:/// url is supported in the download() and get() methods, so it can be specified in conandata.yml too.
The problem is that doing this packages will not be reproducible, this is why it is more recommended to put them in a server, for future reproducibility.

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

No branches or pull requests

2 participants