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

"snet client call" hangs without returning error when service API is not published to IPFS #350

Open
vsbogd opened this issue Nov 7, 2019 · 0 comments
Labels
bug Something isn't working

Comments

@vsbogd
Copy link
Member

vsbogd commented Nov 7, 2019

Steps to reproduce:

  • prepare service metadata without calling snet metadata-init, for example print metadata of already published service into service_metadata.json and change "model_ipfs_hash" in it.
  • publish new service
  • call service

Expected result: snet returns error
Actual result: snet hangs

Commands to reproduce
cat <<EOF >service_metadata.json
{
    "version": 1,
    "display_name": "Example service",
    "encoding": "proto",
    "service_type": "grpc",
    "model_ipfs_hash": "QmfCqHr6RCrUQ81bKFAGykxYCjSLGmH3LFU3dPhnzix1Kd",
    "mpe_address": "0x5C7a4290F6F8FF64c69eEffDFAFc8644A4Ec3a4E",
    "groups": [
        {
            "group_name": "default_group",
            "endpoints": [
                "http://localhost:7000"
            ],
            "pricing": [
                {
                    "price_model": "fixed_price",
                    "price_in_cogs": 1,
                    "default": true
                }
            ],
            "group_id": "aft+fPjiApTaknPrcjTuV/UZvmjGSRJ5eCNHi5/tKp4="
        }
    ],
    "assets": {}
}
EOF

snet service publish snet example-service

snet client call snet example-service default_group add '{ "a": 10, "b": 20 }'
stack trace
# Initilize service with org_id=snet and service_id=example-service
^CTraceback (most recent call last):
  File "/usr/local/bin/snet", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/snet_cli/__init__.py", line 23, in main
    getattr(args.cmd(conf, args), args.fn)()
  File "/usr/local/lib/python3.6/dist-packages/snet_cli/mpe_client_command.py", line 288, in call_server_statelessly
    response = self.call_server_statelessly_with_params(params, group_name)
  File "/usr/local/lib/python3.6/dist-packages/snet_cli/mpe_client_command.py", line 263, in call_server_statelessly_with_params
    self._init_or_update_registered_service_if_needed()
  File "/usr/local/lib/python3.6/dist-packages/snet/snet_cli/mpe_channel_command.py", line 653, in _init_or_update_registered_service_if_needed
    service_metadata, service_registration)
  File "/usr/local/lib/python3.6/dist-packages/snet/snet_cli/mpe_channel_command.py", line 613, in _init_or_update_service_if_needed
    self._get_ipfs_client(), metadata["model_ipfs_hash"], spec_dir)
  File "/usr/local/lib/python3.6/dist-packages/snet/snet_cli/utils_ipfs.py", line 108, in safe_extract_proto_from_ipfs
    spec_tar = get_from_ipfs_and_checkhash(ipfs_client, ipfs_hash)
  File "/usr/local/lib/python3.6/dist-packages/snet/snet_cli/utils_ipfs.py", line 63, in get_from_ipfs_and_checkhash
    block_data = ipfs_client.block_get(ipfs_hash_base58)
  File "/usr/local/lib/python3.6/dist-packages/ipfsapi/client.py", line 310, in block_get
    return self._client.request('/block/get', args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/ipfsapi/http.py", line 37, in wrapper
    return func(self, *args, **merged)
  File "/usr/local/lib/python3.6/dist-packages/ipfsapi/http.py", line 170, in request
    files, headers, data)
  File "/usr/local/lib/python3.6/dist-packages/ipfsapi/http.py", line 100, in _request
    files=files, headers=headers, data=data)
  File "/usr/local/lib/python3.6/dist-packages/ipfsapi/http.py", line 75, in _do_request
    return requests.request(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 421, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 416, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1346, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
@vsbogd vsbogd added the bug Something isn't working label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant