Skip to content
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

Post Response Plugins not called on exception #102

Open
m1h43l opened this issue May 1, 2021 · 0 comments
Open

Post Response Plugins not called on exception #102

m1h43l opened this issue May 1, 2021 · 0 comments

Comments

@m1h43l
Copy link
Collaborator

m1h43l commented May 1, 2021

If either plugin or endpoint sends an escape message/exception the post response plugins are not called anymore.

Depending on what you do in a post response plugin this may cause a memory leak. If a post plugin should release previously allocated memory and gets never called it could be a problem.

How about adding a boolean flag to the request or response struct if the request is still available for processing or has been aborted? And always execute the post response plugin. Then the post plugin could check if it actually needs to do something.

And the post response plugins are also not called if an previous plugin return *off.

        #pragma exception_handler(handleServletException, pResponse, _C1_ALL, _C2_MH_ESCAPE, _CTLA_HANDLE)
        matchingRouting = findRoute(request.pConfig, &request);
        if (matchingRouting) {
            request.routeId.Length = matchingRouting->routeId.Length;
            memcpy(request.routeId.String, matchingRouting->routeId.String, matchingRouting->routeId.Length); 
            request.pRouting = matchingRouting;
        }
        
        allSaysGo = runPlugins (request.pConfig->pluginPreRequest , &request , &response);
        if (allSaysGo) {
            if (pInstance->servlet) {
                pInstance->servlet (&request , &response);
            } else {
                runServletByRouting (&request , &response, matchingRouting ? matchingRouting->servlet:null);
            }
            runPlugins (request.pConfig->pluginPostResponse , &request , &response);
        }
        #pragma disable_handler

        putChunkEnd (&response);

        // Clean up this roundtrip 
        cleanupTransaction (&request , &response);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant