Giter Site home page Giter Site logo

Comments (6)

BiagioFesta avatar BiagioFesta commented on June 12, 2024 1

The expect that produces the QUIC connection parameters must be validated is a mistake imo - I should be able to handle it. It can fail for numerous runtime reasons - like to routing table for an interface being present. A lot can't be sensibly validated without doing what the fn under expect (quinn::Endpoint::connect) does.

Fixed here: 3b54910

from wtransport.

BiagioFesta avatar BiagioFesta commented on June 12, 2024

Hi,
Thank you for reporting this.

I've tried to create a MRE (minimum reproducible example), but with no success.

I've tried the following code, but I understand you probably have multi thread context.

use tracing::error;
use tracing::info;

fn main() {
    tracing_subscriber::fmt::init();

    let config = wtransport::ClientConfig::builder()
        .with_bind_default()
        .with_no_cert_validation()
        .build();

    let rt = tokio::runtime::Runtime::new().expect("Failed building the Runtime");
    let _guard = rt.enter();
    let endpoint = wtransport::Endpoint::client(config).unwrap();

    let t = tokio::spawn(async move {
        info!("before wtransport connect");

        let _connection = endpoint
            .connect("https://localhost:4433")
            .await
            .inspect_err(|e| {
                error!("failed to connect to server: {:?}", e);
            })
            .unwrap();

        info!("Done");
    });

    rt.block_on(t).unwrap();
}

Would it be possible to have a minimum example I can try to reproduce with?
Thank you!

from wtransport.

BiagioFesta avatar BiagioFesta commented on June 12, 2024

I've looked a bit through the code, and I see that this EndpointDriver must be kept around; but I'm not sure what I'm doing wrong

Yeah, it seems the driver task (loop of the QUIC connection) terminated. However, in your snippet of code you are moving the Endpoint inside the async block, so that makes me think it's more a failure in the driver, and thus it terminates itself.

Probably it is related to the async context and where stuff are created, that's why having a reproducible example would help me a lot

from wtransport.

cBournhonesque avatar cBournhonesque commented on June 12, 2024

Thanks for looking into this; I don't really know if it's easy to provide a minimal example that is simple to run.
I ran into it here: https://github.com/cBournhonesque/lightyear/tree/main/examples/simple_box
after I made some changes that means that I create the connection outside of the #[tokio::main] thread.

I actually found a solution that works for me: using the async_compat (https://docs.rs/async-compat/latest/async_compat/) crate in combination with a non-tokio runtime works!
Something like:

IoTaskPool::get()
            .spawn(Compat::new(async move {
                let endpoint = wtransport::Endpoint::client(config)
                    .inspect_err(|e| error!("could not create endpoint: {:?}", e))
                    .unwrap();
                    ...
                    }));

I can try creating a minimal example

from wtransport.

MOZGIII avatar MOZGIII commented on June 12, 2024

The expect that produces the QUIC connection parameters must be validated is a mistake imo - I should be able to handle it. It can fail for numerous runtime reasons - like to routing table for an interface being present. A lot can't be sensibly validated without doing what the fn under expect (quinn::Endpoint::connect) does.

from wtransport.

BiagioFesta avatar BiagioFesta commented on June 12, 2024

Agreed, gonna fix that

from wtransport.

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.