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

Allocating SLH for http server with configuring httpHeapMaxBlocks in yaml #447

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fixed `xplatform.loadFileUTF8` when trying to open nonexistent file (#454)
- Bugfix: fix an incorrect check in the recovery router code which might lead to
the state cell-pool being released prematurely (#446)
- Allocating SLH for http server with configurable value 'httpRequestHeapMaxBlocks' in yaml (#447).

## `2.16.0`
- No yaml value converted to null (#442)
Expand Down
7 changes: 6 additions & 1 deletion c/httpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,7 @@ HttpServer *makeHttpServerInner(STCBase *base,
memcpy(&server->config->sessionTokenKey[0], &sessionTokenKey,
sizeof (sessionTokenKey));
server->config->authTokenType = SERVICE_AUTH_TOKEN_TYPE_LEGACY;
server->config->httpRequestHeapMaxBlocks = HTTP_REQUEST_HEAP_DEFAULT_BLOCKS;

return server;
}
Expand Down Expand Up @@ -1656,6 +1657,8 @@ static HttpServer *makeSecureHttpServerInner(STCBase *base, int port,
int64 now = getFineGrainedTime();
server->config->sessionTokenKeySize = sizeof (now);
memcpy(&server->config->sessionTokenKey[0], &now, sizeof (now));
server->config->httpRequestHeapMaxBlocks = HTTP_REQUEST_HEAP_DEFAULT_BLOCKS;

return server;
}
#endif
Expand Down Expand Up @@ -5821,7 +5824,9 @@ static int httpHandleTCP(STCBase *base,
}
}
#endif // USE_ZOWE_TLS
ShortLivedHeap *slh = makeShortLivedHeap(READ_BUFFER_SIZE,100);
HttpServer *server = (HttpServer*) module->data;
Gautham-coder marked this conversation as resolved.
Show resolved Hide resolved
unsigned int maxBlocks = server->config->httpRequestHeapMaxBlocks;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field should probably be initialized by this point in the httpserver.c code. The reason is, the httpserver.c might be used by non-zss applications which don't know about this filed and might not initialize it.

ShortLivedHeap *slh = makeShortLivedHeap(READ_BUFFER_SIZE, maxBlocks);
#ifndef __ZOWE_OS_WINDOWS
int writeBufferSize = 0x40000;
setSocketWriteBufferSize(peerSocket,0x40000, &returnCode, &reasonCode);
Expand Down
5 changes: 5 additions & 0 deletions h/httpserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@

#define HTTP_SERVER_PRIVILEGED_SERVER_PROPERTY "zisServerName"

#define HTTP_REQUEST_HEAP_DEFAULT_BLOCKS 1024
#define HTTP_REQUEST_HEAP_MIN_BLOCKS 100
#define HTTP_REQUEST_HEAP_MAX_BLOCKS 4096

typedef struct BigBuffer_tag{
ShortLivedHeap *slh; /* can be null */
char *data;
Expand Down Expand Up @@ -220,6 +224,7 @@ typedef struct HTTPServerConfig_tag {
hashtable *userTimeouts;
hashtable *groupTimeouts;
int defaultTimeout;
unsigned int httpRequestHeapMaxBlocks;
/* The config manager is optional, but zss and other servers need
a near-global way to get configuration data.
*/
Expand Down
Loading