Hints, Tips, and Troubleshooting

Useful knowledge about using the platform


Setting environment variables

If you wish to use environment variables for your program, you can set them programmatically inside your application. e.g.

fn main() {
std::env::set_var("RUST_BACKTRACE", "1");


It currently isn't possible to use env_logger with your application. Consequently, this means that using RUST_LOG=warn isn't currently supported. We recommend using the println! macro for now!

API documentation

Our API documentation is available at https://rustdocs.hadean.com/hadean

The hadean crate comes with docstrings based on the rustdoc format. As with any Rust crate, run cargo doc once you're inside the crate directory (e.g. ~/.hadean/sdk/crates/hadean) to compile the API documentation. The generated documentation can be found inside the target directory of the crate. Alternatively, you can use cargo doc --open to compile and open the documentation using your default browser.

Switching Azure subscription

Once you have logged into az in a cluster, your current default subscription is used to select where resources are deployed. You can use the hadean cluster login command to login again, after using az account list and az account set to set your default subscription.

hadean cluster -n my-cluster login

Multiple arguments

Currently, multiple arguments are passed to user binaries in remote clusters as a complete string, as one argument. In the future arguments will be provided as multiple strings and specified as an array in our configuration. For now, you must code against this in your application by either specifying the defaults you want in code, or by re-parsing the complete string provided.

Scaling up with standby-machines

In some situations, when under load and standby-machines is configured to 1 or more, it is possible that the dynamic backend will create additional machines (more than 4). Once scaled up, the stop command will take longer, since it will need to down-scale. When you have more than 4 machines, hadean::spawn will only create applications on 4 of the machines. In the next version of the SDK, this over provisioning will not happen.


Building with the SDK toolchain

When building, if you build with a different toolchain to the SDK's toolchain you will get an error such as:

= note: /home/.../.hadean/sdk/lib/libhadean_foreign.a(std-363511a59ca6fedb.std.2k3kczsj-cgu.0.rcgu.o): In function `__rdl_alloc':
(.text.__rdl_alloc+0x0): multiple definition of `__rdl_alloc'
src/alloc.rs:350: first defined here
/home/.../.hadean/sdk/lib/libhadean_foreign.a(std-363511a59ca6fedb.std.2k3kczsj-cgu.0.rcgu.o): In function `__rdl_alloc_zeroed':
(.text.__rdl_alloc_zeroed+0x0): multiple definition of `__rdl_alloc_zeroed'
src/alloc.rs:382: first defined here

This can be fixed by simply using the same toolchain as the SDK, as described in Prerequisites.

Unsupported attribute in locus: platform

This message is printed just as the dynamic backend begins scaling. Nothing has gone wrong, and the application should scale up in the next 5 to 10 minutes. In future versions we will suppress this message. Please see Deploying to the cloud for a play-by-play of the runtime logs for an example.

Error: terraform plan failed

When running the create command, you may get this error message:

[2021-09-13T13:36:55Z ERROR] terraform plan failed:
Error: building AzureRM Client: obtain subscription() from Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1: ERROR: Please run 'az login' to setup account.
with provider["registry.terraform.io/hashicorp/azurerm"],
on versions.tf line 16, in provider "azurerm":
16: provider "azurerm" {

This can be fixed by simply logging in Azure using az login as described in Prerequisites. In order to deploy to the cloud you need to be logged into your account so the resources can be set up using your subscription.

Could not initialise module: Terraform binary operation error: Failed to execute: `terraform init (or refresh)`

When you run your application for the first time we need to create a backend storage account in Azure that terraform will store its state in.

This error happens when the backend storage account we created for terraform in Azure was not ready yet when terraform started to use it.

Simply repeat the command, running the application again and you won't see this error the second time around.

Unexpected end of file tar

When running the wget command from the Download Platform SDK page you may get the following:

gzip: stdin: unexpected end of file tar: Child returned status 1 tar: Error is not recoverable: exiting now

This is due to the command expiring as it only has a lifetime of 10 minutes. To obtain a new download command simply refresh the page.


You can find us on our Discord channel if you run into any problems or just want to discuss the Hadean Platform SDK!