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

Eval suddenly stops #2979

Open
3 tasks
hiro1234omochi opened this issue Sep 19, 2024 · 1 comment · May be fixed by #3877
Open
3 tasks

Eval suddenly stops #2979

hiro1234omochi opened this issue Sep 19, 2024 · 1 comment · May be fixed by #3877
Assignees
Labels
bug Something isn't working html Related to the html crate
Milestone

Comments

@hiro1234omochi
Copy link

Problem

Steps To Reproduce

  • define a loop coroutine that sends message and loop a eval statement that receives message.
  • wait a little
  • eval loop is suddenly finished.
fn main() {
    // Init logger
    dioxus_logger::init(Level::INFO).expect("failed to init logger");
    info!("starting app");
    launch(App);
}

#[component]
fn App() -> Element {
  let _: Coroutine<()>=use_coroutine(|rx| async move {
    let eval=eval(r#"
      while(true){
        let msg = await dioxus.recv();
        document.getElementById("a").innerHTML=msg;
      }"#);
    let mut a=0;
    loop{
      a+=1;
      eval.send(a.into());
      async_std::task::sleep(Duration::from_millis(10)).await;
    }
  });
  rsx!{
      div { 
          id: "a"
      }

  }  
}

Expected behavior

eval statements keep running .

Screenshots

2024-09-19.21-30-00.mp4

Environment:

  • Dioxus version: 0.6.0-alpha.2
  • Rust version: rustc 1.81.0
  • OS info: windows 11
  • App platform: web

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@ealmloff ealmloff added bug Something isn't working html Related to the html crate labels Sep 19, 2024
@jkelleyrtp jkelleyrtp added this to the 0.6.2 milestone Jan 9, 2025
@jkelleyrtp jkelleyrtp modified the milestones: 0.6.2, 0.6.3 Jan 21, 2025
@DogeDark DogeDark self-assigned this Mar 1, 2025
@DogeDark
Copy link
Member

DogeDark commented Mar 1, 2025

This seems like an issue internally where the eval is getting dropped because of some data getting unintentionally garbage collected on the JS side. Still trying to locate what exactly is getting garbage collected.

Update: I have verified that this is a garbage collection issue.

@DogeDark DogeDark linked a pull request Mar 15, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html Related to the html crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants