Skip to content

Commit 4bd476b

Browse files
authored
Bump AWS_EVENT_STREAM_MAX_MESSAGE_SIZE to 256MB (#122)
1 parent 9422ef7 commit 4bd476b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

include/aws/event-stream/event_stream.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
AWS_PUSH_SANE_WARNING_LEVEL
1717

1818
#define AWS_C_EVENT_STREAM_PACKAGE_ID 4
19-
/* max message size is 16MB */
20-
#define AWS_EVENT_STREAM_MAX_MESSAGE_SIZE (16 * 1024 * 1024)
19+
/* max message size is technically unbounded on the client side, and validated on the server side but we don't want to
20+
* allocate large buffers in case of bugs. 256 MB is a reasonably large buffer size limit. Current service-
21+
* side max is 24 MB, likely to increase in future. */
22+
#define AWS_EVENT_STREAM_MAX_MESSAGE_SIZE (256 * 1024 * 1024)
2123

2224
/* max header size is 128kb */
2325
#define AWS_EVENT_STREAM_MAX_HEADERS_SIZE (128 * 1024)

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ add_test_case(test_streaming_decoder_incoming_multiple_messages)
2828
add_test_case(test_channel_handler_single_valid_messages_parse)
2929
add_test_case(test_channel_handler_multiple_valid_messages_parse)
3030
add_test_case(test_channel_handler_corrupted_crc_fails)
31-
add_test_case(test_channel_handler_msg_too_large_fails)
31+
add_test_case(test_channel_handler_large_msg_success)
3232
add_test_case(test_channel_handler_write_message)
3333

3434
add_net_test_case(test_event_stream_rpc_server_connection_setup_and_teardown)

tests/channel_handler_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ AWS_TEST_CASE_FIXTURE(
384384
&s_test_data)
385385

386386
/* send various valid messages in serial to make sure the happy path of message parsing is correct. */
387-
static int s_test_channel_handler_msg_too_large_fails(struct aws_allocator *allocator, void *ctx) {
387+
static int s_test_channel_handler_large_msg_success(struct aws_allocator *allocator, void *ctx) {
388388
(void)allocator;
389389

390390
struct test_data *test_data = ctx;
@@ -395,7 +395,8 @@ static int s_test_channel_handler_msg_too_large_fails(struct aws_allocator *allo
395395
test_data->received_fn = s_test_on_single_message;
396396
test_data->user_data = &message_test_data;
397397

398-
/* message is 1 byte too large */
398+
/* message length is 16MB + 1 byte. We used to have our stream message limit set at 16MB. Now this test validates
399+
* that we can send messages > 16MB */
399400
uint8_t empty_message[] = {
400401
0x01,
401402
0x00,
@@ -417,15 +418,14 @@ static int s_test_channel_handler_msg_too_large_fails(struct aws_allocator *allo
417418

418419
struct aws_byte_cursor empty_message_cursor = aws_byte_cursor_from_array(empty_message, sizeof(empty_message));
419420
ASSERT_SUCCESS(testing_channel_push_read_data(&s_test_data.testing_channel, empty_message_cursor));
420-
ASSERT_UINT_EQUALS(AWS_ERROR_EVENT_STREAM_MESSAGE_FIELD_SIZE_EXCEEDED, message_test_data.last_error_code);
421-
421+
ASSERT_UINT_EQUALS(AWS_OP_SUCCESS, message_test_data.last_error_code);
422422
return AWS_OP_SUCCESS;
423423
}
424424

425425
AWS_TEST_CASE_FIXTURE(
426-
test_channel_handler_msg_too_large_fails,
426+
test_channel_handler_large_msg_success,
427427
s_fixture_setup,
428-
s_test_channel_handler_msg_too_large_fails,
428+
s_test_channel_handler_large_msg_success,
429429
s_fixture_shutdown,
430430
&s_test_data)
431431

0 commit comments

Comments
 (0)