-
-
Notifications
You must be signed in to change notification settings - Fork 440
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
Possible deadlock with dataloader #555
Comments
This was my first time doing a rest api call rather than a database call inside a dataloader, and this is the only dataloader which has this issue. Wonder if there is any correlation. Maybe interrupted request never finish and get locked? Not sure |
Can you provide a minimal use case that can reproduce this problem? 😁 |
Sorry I am not sure how to reduce it, as all other data loaders I've ever created do not have this issue. Only difference was not using Tiberius for data but instead reqwest |
I am intermittently encountering what appears to be a similar issue with Elasticsearch. After the @servonlewis are you happening to use the work around mentioned at the end of #489 to get actix-web v4 working with Tokio 1.0? Wonder if that's to blame. |
Hey I am actually using warp with tokio 1 |
I've just ran into this exact issue - in developing my backend app I've had no issues querying via the playground but taking a proper client (apollo client in this case) into it and developing a frontend I've ran into this. I'm unsure what exactly is causing this (I'm using foundationdb in my dataloader), but I'll attempt to produce a small POC for further debugging. One of the many times I ran into this, I did manage to produce a panic out of it:
I am unsure if this is related though; it is possible it is entirely unrelated. |
I think I have narrowed it down:
cancelled screenshot: all localhost requests are POSTs to the graphql endpoint, you can see the first is cancelled which makes the third pending forever In this code here in the dataloader: https://github.com/async-graphql/async-graphql/blob/master/src/dataloader/mod.rs#L359-L366 When a request is successful, the I added a println here https://github.com/tombowditch/async-graphql/blob/dataloader-race/src/dataloader/mod.rs#L379 Which leads me to believe the await here https://github.com/async-graphql/async-graphql/blob/master/src/dataloader/mod.rs#L368 is awaiting forever? @sunli829 your input would be appreciated, this is where my lack of knowledge of the codebase fails me :) I hope that is helpful at least :) |
Thank you, these can definitely help me. @tombowditch |
Hey there, I appreciate you guys taking this up, as I am starting to see the error again. As the individual said above, it is only occurring after canceling a request. I am also using Apollo client, so I wonder if there is a proper cancel mechanism on that library. Has there been any update to this issue? |
I think I have found the cause of the problem and I am fixing it. |
I fixed this in the Now the DataLoader::new(MyLoader, tokio::spawn)
DataLoader::new(MyLoader, async_std::task::spawn) |
@sunli829 thank you - I just pulled down the latest commit in Cargo and can confirm I'm not seeing the locks anymore! This is with tokio |
Thank you! How can I pull it down to test? Can you please show me the toml snippet? |
@servonlewis like this:
(make sure to change if you're not using warp & the features) |
Thank you! Will give it a test now. How long does a typical change like this take before it is updated in the main branch and crates.io? I really appreciate the help |
All depends on when @sunli829 publishes a new version - but once it's published it's super quick :) |
Release in |
Thanks! I've updated to that rev, but now i get these errors: | #[Object] and same for InputType. I am not sure if that has documentation for it yet, as i am still looking around. This is one my InputObject structs that it is complaining about. #[derive(Serialize, Deserialize, Debug, InputObject, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VsphereMetricsInput {
pub interval_type: Option<IntervalType>,
pub roll_up_type: Option<RollupType>,
pub resource_id: String,
pub begin: Option<i64>,
pub end: Option<i64>,
} |
@servonlewis did you go from 2.x to 3.x or from 3.x to 3.0.12? |
2.0 |
Please upgrade to |
It looks like the book is still on 2.x, do you have any migration docs? |
looks like it's having trouble with an InputObject that has an enum as a field. #[derive(Serialize, Deserialize, Debug, InputObject, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VsphereMetricsInput {
pub interval_type: Option<IntervalType>,
pub roll_up_type: Option<RollupType>,
pub resource_id: String,
pub begin: Option<i64>,
pub end: Option<i64>,
}
#[derive(Enum, Copy, Clone, Eq, PartialEq, Serialize, Deserialize, Debug)]
pub enum RollupType {
Sum,
Avg,
Min,
Max,
None,
Latest,
Count,
}
#[derive(Enum, Copy, Clone, Eq, PartialEq, Serialize, Deserialize, Debug)]
pub enum IntervalType {
Hours,
Minutes,
Days,
Weeks,
Months,
Years,
} error[E0277]: the trait bound `RollupType: InputType` is not satisfied
--> query_tiberius\src\v_sphere.rs:145:41
|
| ^^^^^^^^^^^ the trait `InputType` is not implemented for `RollupType`
|
= note: required because of the requirements on the impl of `InputType` for `std::option::Option<RollupType>` |
Please disregard, I had forgot to update the version in the other libs in my workspace :( my apologies! |
Looking to test, but the new version doesn't allow for multiple objects with the same name...been going through them all for a while now. Will let you know how it works soon! |
It works!!!! Thank you! |
I forgot to update the version in the book, it has been changed now. 🙂 |
I really appreciate your help with this. The library is too awesome man. |
Hey guys, my dataloader seems to be locking up and not accepting any new request after using the request several times.
This seems to be the only dataloader with this issue, but it is also the only dataloader that i use reqwest rather than my tiberius sql db.
It happens after receiving several interupted request from the client, but never happens if i send a single request using the playground.
That dataloader will not process any further request, and the rest of the query can succeed if i take that part out of the query
The expected behavior is that it does not hang ever.
Please let me know if you require the implementation of any of the functions shown.
The text was updated successfully, but these errors were encountered: