Skip to content

Post Response Plugins not called on exception #102

@m1h43l

Description

@m1h43l

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions