Giter Club home page Giter Club logo

Comments (8)

mattsse avatar mattsse commented on June 12, 2024 1

Each sevice instance create 8 chromium instances, each request to my service would generate HTML to be render, with debug=true in query string, generated HTML would be respond, without this flag, my service would random choose an chromium instance and set content for it.

Sorry I'm afraid I did not understand that part. So I have a couple of questions myself:

  • you're launching 8 different instances of chromium? Each with a new remote-debug-port?
  • you're connecting chromiumoxide::Browser to each of them separately?
  • with debug=true you mean the rust profile right?

If so, then I might know what happens here. There is a difference in overflow handling between rust's release and debug mode: http://huonw.github.io/blog/2016/04/myths-and-legends-about-integer-overflow-in-rust/
basically in release mode there aren't any overflows.
So there seems to be a code path that loops forever, from gdb output, this is the suspect: https://github.com/mattsse/chromiumoxide/blob/main/src/handler/target.rs#L273-L490

Maybe this here: https://github.com/mattsse/chromiumoxide/blob/main/src/cmd.rs#L145 ?

So my hunch is, when you run a lot of commands that may fail, perhaps they don't time out or aren't cleared, so maybe there is some weird edge case that causes so much back pressure to the CommandList that target::poll loops for ever?
Just a hunch.
Those sections could definitely use some log statements. I'd start there.

from chromiumoxide.

mattsse avatar mattsse commented on June 12, 2024 1

I fixed a bug that was related to Commandchain::poll in #56 that resulted in timed out requests weren't cleared and Commandchain::poll called continuously.
Maybe this fixes this issue as well

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

I'm trying to fix this issue, but I am not familiar enough with this part of the code for now, if you can help me with this issue, that would be the best.

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

you're launching 8 different instances of chromium? Each with a new remote-debug-port?

Yes, I launch chromium via --remote-debugging-port=0

you're connecting chromiumoxide::Browser to each of them separately?

Yes, and actix_web::spawn a task to consume everything from Handler.

with debug=true you mean the rust profile right?

No, it's some logic in my service, I was just trying to explain, it's not hang in my code, but, my poor English make you confused.

When I found service is hang, I stopped requests to this instance, and wait for 10 hours, still hang there, and the output of GDB is similar. So, I do belive that not about back pressure.

Here is my htop output, I hope this would be helpful.

图片

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

I've killed all chromiumoxide process, and nothing changed, hang without any error.

图片

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

Good to know, I would like to ask my QA partner test again.

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

Hi, after so many days, finally I found the root cause.

In my case, my service would create and drop Browser again and agin, and without waitpid, there would be a lot of zombie process.

Those zombie process took all available pid, and we could never create new Browser, service looks like hang.

Sorry for my noise, and thanks for your great work.

from chromiumoxide.

DCjanus avatar DCjanus commented on June 12, 2024

This how I fix my problem:

  #[cfg(target_family = "unix")]
  unsafe {
      nix::sys::signal::signal(
          nix::sys::signal::Signal::SIGCHLD,
          nix::sys::signal::SigHandler::SigIgn,
      )
      .expect("set SIGCHLD to SIG_IGN");
  }

from chromiumoxide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.