Timeout problem in start up in long running tasks #2028
Unanswered
alpersergeny
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Update!
Hi,
i'll try and give a little context to what we expirienced:
Setup uses Redis as Broker with streams and a task that takes longer then 3 sec to complete.
We have two Scenarios that should behave the same but they don't:
1st:
We we start the subscriber, then we a a task.
Result: Tast gets completed, faststream waits for more tasks.
2nd:
Subscriber is stopped. We add a Task, then start the Subcriber.
Result: Tasts gets completed but faststream stops with the Timeout-Error.
Reason for the timeout is in the screenshot above: the start()-function throws it, bc. it consumes a tast that takes longer then 3 seconds.
Thx for any assistance and help :)
Details :
![image](https://private-user-images.githubusercontent.com/151834448/401536419-8b0e2a4e-bd8f-4039-81ff-33ae19251856.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjQ2ODIsIm5iZiI6MTczOTYyNDM4MiwicGF0aCI6Ii8xNTE4MzQ0NDgvNDAxNTM2NDE5LThiMGUyYTRlLWJkOGYtNDAzOS04MWZmLTMzYWUxOTI1MTg1Ni5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxMjU5NDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wNDQ2YzU4NWVhNjVmODY4NGM4ZjcxMTNlZTEzZjhkNDQ2MzkxNDZhMjVjYWE0ODFlNTlkZmU5YjYxNmExYTY4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.HCP2tue966wVkAtiBXDhgusNEuCXvbv8ZZE93TpkYqo)
``Hey,
I have a question about the long running tasks. Firstly I have a small environment for reproducing the issue. I am providing the code here (Code for the publisher):
Code for the sub:
![image](https://private-user-images.githubusercontent.com/151834448/401536784-0d36abbe-9578-4521-b3e1-91a60253ab8d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MjQ2ODIsIm5iZiI6MTczOTYyNDM4MiwicGF0aCI6Ii8xNTE4MzQ0NDgvNDAxNTM2Nzg0LTBkMzZhYmJlLTk1NzgtNDUyMS1iM2UxLTkxYTYwMjUzYWI4ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxMjU5NDJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05ODI2NjNlZWYzYTE4NGExMzIwMTEzMWYwMjhkYmI1NGViNGQyMDdlYjNhODVhNTY5MjdiYmI2ZWMzYTZiMDkyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ESFJ1tssSM36TC1JfzyCESpBUWXzKweZrT48MfxlyKg)
Code files for the reproducing will be added here too
To reproduce the issue publisher needs to work on fastapi and sub needs to have a long running task (longer than 3.0 sec).
Steps to reproduce :
If the steps followed end result should be something like this :
As I tracked down the issue comes down to this part of the library :
A small modification to anyio.fail_after(3.0) solves the issue for the long running tasks however, I didnt understand the whole part of the project therefore not sure should I do a change on there. Thank you for all the effort and I am attaching an example case to reproduce the error. Please create the envs for it. Publisher needs
fastapi[standard]
redis
faststream[cli]
Subs:
redis
faststream[cli]
test_pub
Test_sub:
Beta Was this translation helpful? Give feedback.
All reactions