You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing an issue that appears to be similar to the closed issue #52 in which browsers failing to open to new_page don't use the browser's timeout and instead hang indefinitely. It should be noted that I'm on v0.3.1 and so should have the fix from PR #56.
I have a timeout on the new_page() call (longer than the browser's request timeout).
If this timeout is hit and I move on, the browser refuses to allow any other requests until it is torn down.
Here's a minimal repro:
use futures_util::stream::{StreamExt};use chromiumoxide::browser::{Browser,BrowserConfig};use tokio::time::{timeout, sleep,Duration};#[tokio::main]asyncfnmain() -> Result<(),Box<dyn std::error::Error>>{println!("Started...");let(browser,mut handler) = Browser::launch(BrowserConfig::builder().request_timeout(Duration::from_secs(3)).build()?,).await?;
tokio::spawn(asyncmove{loop{let _ = handler.next().await.unwrap();}});// Navigation to a valid sample page succeedsattempt_navigation("https://example.com".to_owned(),&browser).await;// Navigation to invalid url fails (and should). This is a silly example, it // is simply to demonstrate the behaviour. When the browser cannot successfully// open the page, it hangs indefinitely. Follow up requests (even those that// previously worked) will fail until the browser is torn downprintln!("Attempting to navigate to invalid page, should fail and timeout");attempt_navigation("https://%wxample.com".to_owned(),&browser).await;println!("Sleeping for a few seconds to allow timeout to happen");sleep(Duration::from_secs(5)).await;// Attempting the same page navigation that previously succeeded.// -> should now failprintln!("Re-attempting to open previously successful page...");attempt_navigation("https://example.com".to_owned(),&browser).await;returnOk(());}asyncfnattempt_navigation(url:String,browser:&Browser){let page_result = timeout(Duration::from_secs(5), browser.new_page(&url)).await;let _page = match page_result {Ok(_page) => println!("Page {} navigated to successfully",&url),Err(_) => println!("Request for new page timeout"),};return;}
The text was updated successfully, but these errors were encountered:
Great catch,
I tried to debug this, it has definitely something to do with the % sign me thinks, try using a & instead, that works...
What internally happens is that
I'm seeing an issue that appears to be similar to the closed issue #52 in which browsers failing to open to new_page don't use the browser's timeout and instead hang indefinitely. It should be noted that I'm on v0.3.1 and so should have the fix from PR #56.
I have a timeout on the new_page() call (longer than the browser's request timeout).
If this timeout is hit and I move on, the browser refuses to allow any other requests until it is torn down.
Here's a minimal repro:
The text was updated successfully, but these errors were encountered: