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
When using a middleware that performs an asynchronous operation, the endpoint /api/v1/my_resource_problem stalls and never responds. In contrast, the endpoints /api/v1/my_resource and /api/v1/my_resource_functional work as expected.
Send a POST request with valid JSON data to the following endpoints:
/api/v1/my_resource
/api/v1/my_resource_functional
/api/v1/my_resource_problem
Expected Behavior
All endpoints should respond with (and print the posted data in the stdout):
{
"success": True
}
Actual Behavior
/api/v1/my_resource and /api/v1/my_resource_functional respond correctly.
/api/v1/my_resource_problem stalls and never replies.
Additional Information
It appears that await res.get_json() enters an infinite loop when a previous middleware performs an asynchronous call, such as my_random_number = await simple_database.get_data().
Environment
socketify Version: 0.0.31
Note: same behavior happens on data = await res.get_data().
Actually the problem seems to happen inside the .get_data() (it is called from the .get_json().
The text was updated successfully, but these errors were encountered:
also, it seems that a call to res.get_data() or res.get_json() works, just before an asynchronous call.
When posting on the problematic endpoint, it will successfully print a valid json once, and then will hang, this modified middleware can show this behavior:
asyncdefproblem_middleware(res, req, data=None):
data=awaitres.get_json() # Will not hangprint(data) # Will print normallymy_random_number=awaitsimple_database.get_data()
data=awaitres.get_json() # Will Hang foreverprint(data)
return {"hello":"world"}
When using a middleware that performs an asynchronous operation, the endpoint
/api/v1/my_resource_problem
stalls and never responds. In contrast, the endpoints/api/v1/my_resource
and/api/v1/my_resource_functional
work as expected.Steps to Reproduce
Run the following code:
Send a POST request with valid JSON data to the following endpoints:
/api/v1/my_resource
/api/v1/my_resource_functional
/api/v1/my_resource_problem
Expected Behavior
All endpoints should respond with (and print the posted data in the stdout):
Actual Behavior
/api/v1/my_resource
and/api/v1/my_resource_functional
respond correctly./api/v1/my_resource_problem
stalls and never replies.Additional Information
It appears that
await res.get_json()
enters an infinite loop when a previous middleware performs an asynchronous call, such asmy_random_number = await simple_database.get_data()
.Environment
Note: same behavior happens on
data = await res.get_data()
.Actually the problem seems to happen inside the
.get_data()
(it is called from the.get_json()
.The text was updated successfully, but these errors were encountered: