# Daml ledger upload-dar gives GRPCIOTimeout

**URL:** <https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743>\
**Category:** App Development\
**Tags:** grpc, ledger-api\
**Created:** [June 22, 2021, 3:57pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743 "2021-06-22T15:57:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 22, 2021, 3:57pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/1 "2021-06-22T15:57:24Z")

</div>

I have a small `x.dar` (312K), and I launch an empty Daml Sandbox with `daml sandbox`, then I get this:

```haskell
daml ledger upload-dar --host localhost --port 6865 x.dar
Uploading x.dar to localhost:6865
An exception was thrown during the upload-dar command
- GRPCIOTimeout
One reason for this to occur is if the size of DAR file being uploaded exceeds the gRPC maximum message size. The default value for this is 4Mb, but it may be increased when the ledger is (re)started. Please check with your ledger operator.

```

GRPC should work (I know :troll: ), because I can attach to the Sandbox with `daml repl` or `daml ledger navigator`.

Also, when I launch the Sandbox via `daml sandbox x.dar`, it loads the DAR perfectly.

Possibly helpful info: on this VM, I can only run `daml test` by setting `no_proxy=127.0.0.1`, otherwise I get  
GRPC error (solved [here](https://stackoverflow.com/questions/64471296/daml-test-command-is-failed-with-damlc-user-error-failed-to-start-scenario-se)).

Possibly _not_ helpful info: I already checked [Daml-helper: GRPCIOTimeout error](https://discuss.daml.com/t/daml-helper-grpciotimeout-error/1209) and [GRPCIOTimeout with daml deploy when running within a docker container - #2 by perbergman](https://discuss.daml.com/t/grpciotimeout-with-daml-deploy-when-running-within-a-docker-container/2539/2), this seems to be a different issue.

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [June 22, 2021, 4:03pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/2 "2021-06-22T16:03:38Z")

</div>

> [@Richard\_Kapolnai](#):
>
> Possibly helpful info: on this VM, I can only run `daml test` by setting `no_proxy=127.0.0.1` , otherwise I get  
> GRPC error (solved [here](https://stackoverflow.com/questions/64471296/daml-test-command-is-failed-with-damlc-user-error-failed-to-start-scenario-se)).

Did you run your `upload-dar` command with or without the `no_proxy` env var set to the same value as your `--host` option? (Proxy may happen before DNS resolution.)

---

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 22, 2021, 4:17pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/3 "2021-06-22T16:17:26Z")

</div>

I think you’ve just led me to a workaround and to a minor bug, thank you!  
Apparently `daml ledger` does not resolve `localhost`. Manually resolving it resolves my issue:

```haskell
 daml ledger upload-dar --host 127.0.0.1 --port 6865 x.dar
Uploading x.dar to 127.0.0.1:6865
DAR upload succeeded.

$ daml ledger upload-dar --host localhost --port 6865 x.dar
Uploading x.dar to localhost:6865
An exception was thrown during the upload-dar command
- GRPCIOTimeout
One reason for this to occur is if the size of DAR file being uploaded exceeds the gRPC maximum message size. The default value for this is 4Mb, but it may be increased when the ledger is (re)started. Please check with your ledger operator.

$ host localhost
localhost has address 127.0.0.1

```

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [June 22, 2021, 4:20pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/4 "2021-06-22T16:20:16Z")

</div>

Out of pure curiosity, can you try this?

```plaintext
no_proxy=localhost daml ledger upload-dar --host localhost --port 6865 x.dar

```

---

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 22, 2021, 4:22pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/5 "2021-06-22T16:22:07Z")

</div>

```haskell
$ no_proxy=localhost daml ledger upload-dar --host localhost --port 6865 x.dar
Uploading x.dar to localhost:6865
DAR upload succeeded.

```

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 22, 2021, 4:33pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/6 "2021-06-22T16:33:04Z")

</div>

So it sounds like there isn’t a bug, just a proxy issue?

---

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 22, 2021, 4:35pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/7 "2021-06-22T16:35:04Z")

</div>

As a user, I would expect `localhost` and `127.0.0.1` to behave identically.  
We can call it inconvenience instead of a bug 🙂 , but I doubt I would have beeen able to figure this out on my own.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 22, 2021, 4:36pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/8 "2021-06-22T16:36:39Z")

</div>

Afaict they do behave identically? You said at the beginning that you need to set `no_proxy=127.0.0.1` for it to work. Now it seems like if you set `no_proxy=localhost` that works as well. That seems consistent to me?

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [June 22, 2021, 5:29pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/9 "2021-06-22T17:29:56Z")

</div>

It looks like the proxy decision is made before DNS resolution (which kinda makes sense), so your `no_proxy` list has to contain the same hostname you pass to `--host`. I don’t think we can realistically do anything about how proxies work.

---

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 22, 2021, 5:46pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/10 "2021-06-22T17:46:13Z")

</div>

Thank you, these all start to make sense to me. Although I _had_ to set `no_proxy=127.0.0.1`, otherwise `daml test` won’t work (I tried, no luck with `localhost`), but as you wrote I should remember how it is set, and replace all `localhost` with `127.0.0.1`. Although although `daml script` accepts `localhost` 🙂 .  
Thanks again for the help!

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 22, 2021, 5:49pm UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/11 "2021-06-22T17:49:39Z")

</div>

Let me try to clarify some of the confusion:

1. `daml test` internally connects to the scenario service via gRPC. It connects via 127.0.0.1 instead of `localhost` so you always need to set `no\_proxy=127.0.0.1z.
2. `daml ledger upload-dar` uses whatever you supply. If you pass `--ledger-host=localhost` you need `no_proxy=localhost` and the other way around.
3. `daml script` uses the Java gRPC library contrary to the first two which use the (Haskell bindings to the) C++ gRPC library. Proxy handling works differently between the two which is why one can work if the other doesn’t.  
All the proxy handling happens in those underlying libraries so we have little to no control over it unfortunately.

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [June 23, 2021, 11:01am UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/12 "2021-06-23T11:01:02Z")

</div>

`no_proxy` is not super standardized AFAIK, but you _should_ be able to give it a list of hostnames. I _think_ the separator is usually a comma, but you may have to check with your actual proxy provider. It’s worth testing, as that’s faster than going through docs:

```plaintext
export no_proxy=localhost,127.0.0.1
daml test
daml ledger upload-dar --host localhost --port 6865 x.dar

```

---

<div class="post-metadata">

**Author:** ![Richard\_Kapolnai](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/richard_kapolnai/32/89_2.png) [@Richard\_Kapolnai](https://forum.canton.network/u/Richard_Kapolnai)\
**Post date:** [June 23, 2021, 11:17am UTC](https://forum.canton.network/t/daml-ledger-upload-dar-gives-grpciotimeout/2743/13 "2021-06-23T11:17:10Z")

</div>

I confirm, `export no_proxy=localhost,127.0.0.1` worked for me! 🙂
