[Test PR] for upload memory leak#786
Draft
Gautham-coder wants to merge 2 commits intov3.x/stagingfrom
Draft
Conversation
Signed-off-by: Gautham Kuppuswamy <gkuppuswamy@rocketsoftware.com>
Signed-off-by: Gautham Kuppuswamy <gkuppuswamy@rocketsoftware.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/zowe/zowe-common-c/blob/c6f577921787ec7489341270dfffd5b0878b7e60/c/httpserver.c#L5829 - makeSLH
https://github.com/zowe/zowe-common-c/blob/c6f577921787ec7489341270dfffd5b0878b7e60/c/httpserver.c#L6215 - SLHFree
https://github.com/zowe/zowe-common-c/blob/c6f577921787ec7489341270dfffd5b0878b7e60/c/alloc.c#L604 - safeFree64Internal() ; free() not done
`************** Code flow for each chunk write **************
httpHandleTCP()
https://github.com/zowe/zowe-common-c/blob/c6f577921787ec7489341270dfffd5b0878b7e60/c/httpserver.c#L5829
- ShortLivedHeap slh = makeShortLivedHeap(READ_BUFFER_SIZE=65536, maxBlocks=1024);
- peerExtension = makeSocketExtension(.., slh,..)
- httpConversation = makeHttpConversation(peerExtension,(HttpServer)(module->data));
-> conversation->parser = makeHttpRequestParser(socketExtension->slh); / allocates the parser on the SLH */
httpWorkElementHandler
case START_RESP
handlePeerSocketRead() ->
- SocketExtension *peerExtension = extension;
- HttpConversation conversation = (HttpConversation)extension->protocolHandler;
doHttpReadWork() ->
- socketRead()
- processHttpFragment(parser,readBuffer,bytesRead);
processHttpFragment(parser,readBuffer,bytesRead)); ->
- After processing headers
https://github.com/zowe/zowe-common-c/blob/8104c38753286bb15579cbb810adb78be51ea8c0/c/httpserver.c#L2330
- parser->content = SLHAlloc(parser->slh,parser->specifiedContentLength);
resetParserAndEnqueue(parser) ->
https://github.com/zowe/zowe-common-c/blob/8104c38753286bb15579cbb810adb78be51ea8c0/c/httpserver.c#L2343
enqueueLastRequest(parser) ->
- HttpRequest newRequest = (HttpRequest)SLHAlloc(parser->slh,sizeof(HttpRequest));
- newRequest->contentBody = copyString(parser->slh, parser->content, parser->specifiedContentLength);
httpWorkElementHandler() ->
doHttpResponseWork() ->
HttpRequest *firstRequest = dequeueHttpRequest(parser);
response = makeHttpResponse(firstRequest,parser->slh,conversation->socketExtension->socket);
- ShortLivedHeap *responseSLH = makeShortLivedHeap(65536,100);
handleHttpService()
serveRequest() ->
serveUnixFileContents(HttpService *service, HttpResponse *response) ->
response->request->contentBody
doChunking() -> (if 1st chunk assignSessionID->respondWithSessionID->handlePeerSocketRead)
writeAsciiDataFromBase64() ->
finishResponse() ->
doHttpReadWork (BACK HERE)
handlePeerSocketRead() (BACK HERE)
https://github.com/zowe/zowe-common-c/blob/8104c38753286bb15579cbb810adb78be51ea8c0/c/httpserver.c#L5723
httpWorkElementHandler()
HTTP_CLOSE_CONVERSATION - SLHFree(sext->slh) This is the SLH allocated in '1'
https://github.com/zowe/zowe-common-c/blob/c6f577921787ec7489341270dfffd5b0878b7e60/c/httpserver.c#L6215
httpHandleTCP() (BACK HERE)
************** END OF PROCESSING CHUNK **************`
zowe-common-c: zowe/zowe-common-c#540