dfinity / sdk

IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.
https://internetcomputer.org/developers
Apache License 2.0
174 stars 83 forks source link

Local development intro tutorial doesn't work on Windows WSL environment #2792

Open Agent009 opened 1 year ago

Agent009 commented 1 year ago

Hi team,

I've discussed the issue in Discord here and here.

I'm running dfx on a Ubuntu machine (Ubuntu 20.04 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)) running on Windows 10 WSL. I followed the official docs for setting up dfx via WSL. I'm running node version v19.1.0 and dfx version 0.12.1.

[windows_dir]>wsl -l -v
  NAME                   STATE           VERSION
* docker-desktop-data    Stopped         2
  Ubuntu                 Running         1

This is the process I followed:

dfx new hello
dfx start --clean --background

Everything looked good, and I could access the dashboard that opens up.

Running dfx start for version 0.12.1
Using the default definition for the 'local' shared network because /home/amir/.config/dfx/networks.json does not exist.

Then, running dfx deploy ends with an error:

Creating a wallet canister on the local network.
thread 'main' panicked at 'assertion failed: (left == right)
  left: 819200,
 right: 0: The page allocator was initialized with non-empty file', replicated_state/src/page_map/page_allocator/mmap.rs:399:9

I followed a few suggestions including using the --clean option when starting dfx, as well as deleting the .dfx dir, but nothing worked.

I also tried an alternative command, but got the same issue:

dfx start --clean --backgroun
dfx identity get-wallet

Gives:

Creating a wallet canister on the local network.
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `819200`,
 right: `0`: The page allocator was initialized with non-empty file', replicated_state/src/page_map/page_allocator/mmap.rs:399:9
version: 0.8.1
 Error: Failed to get wallet for identity 'default' on network 'local'.
Caused by: Failed to get wallet for identity 'default' on network 'local'.
  Failed to create wallet for identity 'default' on network 'local'.
    Failed while installing wasm.
      The replica returned an HTTP Error: Http Error: status 500 Internal Server Error, content type "", content: Internal Server Error
Nov 30 19:21:06.947 WARN Internal Error during request:
hyper::Error(
    Connect,
    ConnectError(
        "tcp connect error",
        Os {
            code: 111,
            kind: ConnectionRefused,
            message: "Connection refused",
        },
    ),
)

I then downgraded to version 0.10.1 which started to work as expected. I suppose the issue is with the latest version then (0.12.1).

Meta

dfx --version:

0.12.1
Further log output

``` ```

sesi200 commented 1 year ago

Thank you for the report, the team is looking into it. (Link for myself for later)

sesi200 commented 1 year ago

From internal comms:

it is a runtime issue. Looks like tempfile::tempfile() is giving an already existing file to dfx on WSL

Will update if anything else comes from it

Agent009 commented 1 year ago

Thanks. It's probably an issue with WSL2 vs WSL. I was running the Ubuntu VM on WSL, but I've recently upgraded it to WSL2, so will try running another test if and when I get some free time to experiment with this again.