-
Notifications
You must be signed in to change notification settings - Fork 65
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
Behaviour when trying to access the payload after responding #514
Behaviour when trying to access the payload after responding #514
Comments
Since we are clearing out the leftover HTTP content once the request-response transaction is over, to avoid memory leaks, if the user tries to access the request payload for the first time after respond, at least we should send an error instead of letting it to hang. If we move the clearing out part of the HTTP content at the end of resource execution, this might work. But prior to doing that we need to investigate all the consequences. There's a 'dirty' flag we maintained for the outbound request (when the outbound request is used more than once by a client/clients). May be we could use the same mechanism for inbound request as well. |
The reason for releasing content at the final state of response path is to avoid potential memory leak ( ballerina-platform/ballerina-lang#12815 ) which can occur when the request is not dispatched to a particular resource. One thing we can do is moving that content release to all possible inbound request failure paths. |
And do a load test by monitoring memory behaviour in following cases
|
Following are the load test profiling results for above scenarios after proposed changed. (Load test concurrency 50) As per the load testing results no memory leak was found hence the proposed implementation will be added to code base. |
Reopen due to #1731 |
Description:
$title.
Steps to reproduce:
When invoking the service, execution seems to hang at
req.getJsonPayload()
eventually resulting in a timeout error.$ ballerina run foo.bal [ballerina/http] started HTTP/WS listener 0.0.0.0:8080 BAR error {ballerina/http}GenericClientError message=Error occurred while retrieving the json payload from the request cause=error {ballerina/mime}ParsingEntityBodyFailed message=Error occurred while extracting json data from entity: No entity was added to the queue before the timeout BAR2
As pointed out by @arukshani, this works if we've accessed the payload prior to responding.
Is this the correct behaviour?
Affected Versions:
The text was updated successfully, but these errors were encountered: