Skip to content

p2p proxy doesn't work with registryfs v2 #361

@fengwang-db

Description

@fengwang-db

What happened in your environment?

Hey, we tried to upgrade our overlaybd installation from 0.6.17 to 1.0.13 and found out p2p proxy doesn't work with registryfs v2. The new http client in registryfs v2 is not able to parse the local p2p endpoint correctly. See the following logs:

Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182677|DEBUG|th=00007E28A80866C0|registryfs_v2.cpp:166|get_data:p2p_url: 127.0.0.1:8181/overlaybd/https://**redacted**.blob.core.windows.net/harbor//docker/registry/v2/blobs/sha256/88/****redacted*****/data?se=2025-02-26T23%3A49%3A07Z&sig=Z0dBLr8s6D8xouLHGQ6P11gibD08CgduRNskibZ9Slg%3D&sp=r&sr=b&sv=2016-05-31
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182680|DEBUG|th=00007E28A80866C0|url.cpp:44|from_string:[url=127.0.0.1:8181/overlaybd/https://**redacted**.blob.core.windows.net/harbor//docker/registry/v2/blobs/sha256/88/****redacted*****/data?se=2025-02-26T23%3A49%3A07Z&sig=Z0dBLr8s6D8xouLHGQ6P11gibD08CgduRNskibZ9Slg%3D&sp=r&sr=b&sv=2016-05-31]
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182682|DEBUG|th=00007E28A80866C0|message.cpp:312|reset:requst reset [u.host()=**redacted**.blob.core.windows.net][enable_proxy=0]
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182685|DEBUG|th=00007E28A80866C0|client.cpp:154|do_roundtrip:[concurreny=1]
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182687|DEBUG|th=00007E28A80866C0|client.cpp:67|dial:Dial to **redacted**.blob.core.windows.net 80
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182689|DEBUG|th=00007E28A80866C0|client.cpp:71|dial:Connecting 20.60.233.225:80 ssl: 0
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182694|DEBUG|th=00007E28A80866C0|client.cpp:82|dial:Connected 20.60.233.225:80 host : **redacted**.blob.core.windows.net ssl: 0 000063364D44CC80
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182696|DEBUG|th=00007E28A80866C0|client.cpp:166|do_roundtrip:Sending request 2 /harbor//docker/registry/v2/blobs/sha256/88/****redacted*****/data?se=2025-02-26T23%3A49%3A07Z&sig=Z0dBLr8s6D8xouLHGQ6P11gibD08CgduRNskibZ9Slg%3D&sp=r&sr=b&sv=2016-05-31
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.182702|DEBUG|th=00007E28A80866C0|client.cpp:195|do_roundtrip:Request sent, wait for response 2 /harbor//docker/registry/v2/blobs/sha256/88/****redacted*****/data?se=2025-02-26T23%3A49%3A07Z&sig=Z0dBLr8s6D8xouLHGQ6P11gibD08CgduRNskibZ9Slg%3D&sp=r&sr=b&sv=2016-05-31
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184306|DEBUG|th=00007E28A80866C0|message.cpp:108|append_bytes:add headers, header buf size 65053
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184312|DEBUG|th=00007E28A80866C0|message.cpp:114|append_bytes:header parsed
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184314|DEBUG|th=00007E28A80866C0|client.cpp:211|do_roundtrip:Got response 2 /harbor//docker/registry/v2/blobs/sha256/88/****redacted*****/data?se=2025-02-26T23%3A49%3A07Z&sig=Z0dBLr8s6D8xouLHGQ6P11gibD08CgduRNskibZ9Slg%3D&sp=r&sr=b&sv=2016-05-31 code=400 || content_length=284
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184317|ERROR|th=00007E28A80866C0|registryfs_v2.cpp:186|get_data:Failed to fetch data [url=https://**redacted**.com/v2/main/dbr/spark-image/blobs/sha256:****redacted*****][op.status_code=400][ret=400]
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184319|ERROR|th=00007E28A80866C0|registryfs_v2.cpp:504|get_length:failed to get meta from server
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184328|ERROR|th=00007E28A80866C0|registryfs_v2.cpp:530|open:failed to open and stat registry file /https://**redacted**.com/v2/main/dbr/spark-image/blobs/sha256:****redacted*****, ret -1 errno=110(Connection timed out)
Feb 26 23:29:32  overlaybd-tcmu[2226]: 2025/02/26 23:29:32.184334|ERROR|th=00007E28A80866C0|store.cpp:368|open_src_file:open source /https://**redacted**.com/v2/main/dbr/spark-image/blobs/sha256:****redacted***** failed errno=110(Connection timed out)

There are two errors in the above log.

  1. The url host is parsed incorrectly: 23:29:32.182682|DEBUG|th=00007E28A80866C0|message.cpp:312|reset:requst reset [u.host()=**redacted**.blob.core.windows.net][enable_proxy=0]
  2. For some reason, the request to the azure storage account also failed (got 400 code).

What did you expect to happen?

No response

How can we reproduce it?

Enabling p2p proxy with the 1.0.13 version should reproduce this.

What is the version of your Overlaybd?

1.0.13

What is your OS environment?

azure linux

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions