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

perseus serve crashes with no error on Arch Linux #78

Closed
njittam opened this issue Nov 14, 2021 · 13 comments
Closed

perseus serve crashes with no error on Arch Linux #78

njittam opened this issue Nov 14, 2021 · 13 comments
Assignees
Labels
C-bug Category: bug P-high Priority: high S-waiting-on-author Status: waiting on author

Comments

@njittam
Copy link
Contributor

njittam commented Nov 14, 2021

Describe the bug
The bug consists of 2 bugs. But I think the first bug is already described in #74. It basicly crashes with the serve command. I Think I found a workaround by not building the package with serve. The second bug(the reason why I created a new issue) is the webpage crashes in the Hello World example. Presumably because of an example in the package.

To Reproduce
Steps to reproduce the behavior:

  1. create project according to hello world example in https://arctic-hen7.github.io/perseus/en-US/docs/0.2.x/hello-world
  2. $perseus build
  3. $perseus serve
    3.1 this stops with this output which is unexpected but I think this is related to Some errors in compilation/execution don't appear in the CLI output #74
    [1/4] 🔨 Generating your app...✅
⠠ [3/4] 📡 Building server...
  1. $perseus serve --no-build
  2. goto localhost:8080
  3. see Hello World for a second which disappears.
  4. open console and see the additional info

Expected behavior
See a hello word

Screenshots
None

Environment (please complete the following information):

  • Perseus Version: v0.2.0
  • Sycamore Version: v0.6.0
  • OS: manjaro
  • Browser: firefox
  • Browser Version: 94.0

Additional context

$perseus -v                                       
You are currently running the Perseus CLI v0.2.3! You can see the latest release at https://github.com/arctic-hen7/perseus/releases.

Console Output

panicked at 'called `Option::unwrap()` on a `None` value', /home/arctic_hen7/Coding/Projects/perseus/examples/basic/src/templates/index.rs:41:63

Stack:

init/imports.wbg.__wbg_new_59cb74e423758ede@http://localhost:8080/.perseus/bundle.js:327:19              bundle.js:340:13
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[317]:0x42255
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[1012]:0x5b3f8
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[525]:0x52361
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[597]:0x5545b
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[825]:0x5a17d
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[792]:0x59af6
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[826]:0x5a1b3
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[767]:0x59476
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[162]:0x28513
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[798]:0x59c69
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[250]:0x39bc8
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[158]:0x2705c
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[415]:0x4b37e
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[259]:0x3b177
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[987]:0x5b2da
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[91]:0x24e1
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[475]:0x4f6ca
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[438]:0x4ce36
@http://localhost:8080/.perseus/bundle.wasm:wasm-function[893]:0x5ac1b
__wbg_adapter_23@http://localhost:8080/.perseus/bundle.js:210:10
real@http://localhost:8080/.perseus/bundle.js:191:20



    __wbg_error_4bb6c2a97407129a http://localhost:8080/.perseus/bundle.js:340
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:271185
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:373752
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:336737
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:349275
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:369021
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:367350
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:369075
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:365686
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:165139
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:367721
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:236488
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:159836
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:308094
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:242039
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:373466
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:9441
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:325322
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:314934
    <anonymous> http://localhost:8080/.perseus/bundle.wasm:371739
    __wbg_adapter_23 http://localhost:8080/.perseus/bundle.js:210
    real http://localhost:8080/.perseus/bundle.js:191
    
   --------------------------------------------------------------------------
Uncaught (in promise) RuntimeError: unreachable executed                                                  bundle.wasm:336791:1
    __wbg_adapter_23 http://localhost:8080/.perseus/bundle.js:210
    real http://localhost:8080/.perseus/bundle.js:191

@arctic-hen7
Copy link
Member

Would you mind trying with the latest beta version and seeing if you can reproduce it there?

@arctic-hen7 arctic-hen7 self-assigned this Nov 15, 2021
@arctic-hen7 arctic-hen7 added C-bug Category: bug P-high Priority: high S-waiting-on-author Status: waiting on author labels Nov 15, 2021
@njittam
Copy link
Contributor Author

njittam commented Nov 15, 2021

I will try tonight.
I am not quite sure how to do that.
Do I only update the Cargo.toml like this?

perseus = "0.3.0-beta.17"

or should I also update the cli? and if so how?

@phaleth
Copy link
Contributor

phaleth commented Nov 15, 2021

@njittam, yes, the Perseus CLI also needs to be updated with cargo install perseus-cli --version "0.3.0-beta.17" including that version flag specifically.

@njittam
Copy link
Contributor Author

njittam commented Nov 15, 2021

Ok, It still doesnt't work for new reasons. I do see Hello world now. But the console errorrs.
These are the steps I took:

$ rm -rf .perseus
$ sed -i 's/0.2/0.3.0-beta.17/g' Cargo.toml
$ rm src/lib.rs && touch src/lib.rs
# update lib.rs to the new file at https://arctic-hen7.github.io/perseus/en-US/docs/0.3.x/hello-world
$ cargo install perseus-cli --version "0.3.0-beta.17" 
$ perseus build
$ perseus serve # still doesn't work no new information here
$ perseus serve --no-build
# goto localhost:8080

console output:

Loading failed for the module with source “http://localhost:8080/.perseus/bundle.js”. localhost:8080:9:1
Loading module from “http://localhost:8080/.perseus/bundle.js” was blocked because of a disallowed MIME type (“text/plain”).  [Learn More]  localhost:8080

Learn More link: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options

@phaleth
Copy link
Contributor

phaleth commented Nov 16, 2021

@njittam, I guess you've installed rust and cargo, which means you might get similar output for cargo --version as shown right bellow.

user@debian:~$ cargo --version
cargo 1.55.0 (32da73ab1 2021-08-23)

Did you also run the two following commands before installing perseus-cli?

# download the target for wasm
rustup target add wasm32-unknown-unknown

# install wasm-pack
cargo install wasm-pack

I don't think this is Manjaro or Arch related issue, but it could be.

@njittam
Copy link
Contributor Author

njittam commented Nov 18, 2021

@phaleth

$cargo --version
cargo 1.55.0 (32da73ab1 2021-08-23)
$ cargo install wasm-pack
    Updating crates.io index
    Ignored package `wasm-pack v0.10.1` is already installed, use --force to override
$ rustup target add wasm32-unknown-unknown
info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date

@njittam
Copy link
Contributor Author

njittam commented Nov 18, 2021

I tried running the example in chromium Version 94.0.4606.81 (Official Build) Arch Linux (64-bit)
And there the console says this

Failed to load resource: the server responded with a status of 404 (Not Found)                  bundle.js:1 
Failed to load resource: the server responded with a status of 404 (Not Found)                  :8080/favicon.ico:1 

and after f5

GET http://localhost:8080/.perseus/bundle.js net::ERR_ABORTED 404 (Not Found)                              localhost/:10 

in firefox I also get an 404 on bundle.js
I think bundle.js might not be created?

@arctic-hen7
Copy link
Member

Can you give me an exact series of steps that you're following from scratch to replicate this? (I'm not getting the same issue.)

@phaleth
Copy link
Contributor

phaleth commented Nov 19, 2021

@arctic-hen7, it's most likely Arch related. I've tried perseus deploy with the bellow Dockerfile on an Arch based image and I get an error without a trace.

Dockerfile

# get the base image
FROM rnestler/archlinux-rust:1.56.1 AS build

# install build dependencies
RUN pacman --noconfirm -Sy lsb-release \
  base-devel curl

# vars
ENV PERSEUS_VERSION=0.3.0-beta.17

# prepare root project dir
WORKDIR /app

# download the target for wasm
RUN rustup target add wasm32-unknown-unknown

# install wasm-pack
RUN cargo install wasm-pack

# retrieve the src dir
RUN curl https://codeload.github.com/arctic-hen7/perseus/tar.gz/v${PERSEUS_VERSION} | tar -xz --strip=2 perseus-${PERSEUS_VERSION}/examples/tiny

# go to src dir
WORKDIR /app/tiny

# install perseus-cli
RUN cargo install perseus-cli --version $PERSEUS_VERSION

# clean app
RUN perseus clean

# specify deps in app config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" ./Cargo.toml \
  && cat ./Cargo.toml

# prep and eject app
RUN perseus prep && perseus eject

# adjust and append perseus config
RUN sed -i s"/perseus = .*/perseus = \"${PERSEUS_VERSION}\"/" .perseus/Cargo.toml \
  && cat .perseus/Cargo.toml

# deploy app
RUN perseus deploy

# prepare deployment image
FROM archlinux:base-20211114.0.39041

WORKDIR /app

COPY --from=build /app/tiny/pkg /app/

ENV PERSEUS_STANDALONE=true

ENV HOST=0.0.0.0

CMD ["./server"]

Trimmed output of docker build

...
Step 14/20 : RUN perseus deploy
 ---> Running in 1987364a53d9
The command '/bin/sh -c perseus deploy' returned a non-zero code: 1

@arctic-hen7
Copy link
Member

Okay that's very interesting. I guess I'm playing around in an Arch shell then!

@arctic-hen7
Copy link
Member

I've created an MRE repo for this here, though I can only replicate the issue with running perseus serve, there are no console errors after using the --no-build workaround. @njittam could you try using this repo on your local machine (without Docker) and see if you still get console errors?

@arctic-hen7
Copy link
Member

Okay, this is distinct from #74, because this issue is being caused by a segmentation fault in wasm-pack. This seems to be the cause, which is due to an OpenSSL error. I'm afraid there's just about nothing I can do to fix this, but downgrading to a previous version of wasm-pack seems to do the trick in my MRE repo (cargo install wasm-pack --version "0.9.1"). I'll add a note to the docs about this.

@njittam could you please confirm that downgrading wasm-pack fixes this issue for you (in my MRE repo as linked above)? I think the problem of console errors is either derived from this, or is a separate configuration issue, because I'm not getting that in an Arch Docker container.

@arctic-hen7 arctic-hen7 changed the title Hello World example crashes perseus serve crashes with no error on Arch Linux Nov 28, 2021
arctic-hen7 added a commit to arctic-hen7/perseus-mre-78 that referenced this issue Nov 28, 2021
@arctic-hen7
Copy link
Member

@njittam I'm going to close this, please let me know if the issue is still persisting for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug P-high Priority: high S-waiting-on-author Status: waiting on author
Projects
None yet
Development

No branches or pull requests

3 participants