Skip to content

Commit 56065a3

Browse files
jordanhunt22Convex, Inc.
authored andcommitted
Increase max args + return sizes (#35626)
GitOrigin-RevId: c88e9c84e4322617b98a2784d87e11e5e500951c
1 parent bcfea8b commit 56065a3

File tree

3 files changed

+37
-36
lines changed

3 files changed

+37
-36
lines changed

crates/common/src/knobs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ pub static MAX_TRANSACTION_WINDOW: LazyLock<Duration> =
225225

226226
/// Maximum size in bytes of arguments to a function.
227227
pub static FUNCTION_MAX_ARGS_SIZE: LazyLock<usize> = LazyLock::new(|| {
228-
env_config("FUNCTION_MAX_ARGS_SIZE", 1 << 23) // 8 MiB
228+
env_config("FUNCTION_MAX_ARGS_SIZE", 1 << 24) // 16 MiB
229229
});
230230

231231
/// Maximum size in bytes of the result of a function.
232232
pub static FUNCTION_MAX_RESULT_SIZE: LazyLock<usize> = LazyLock::new(|| {
233-
env_config("FUNCTION_MAX_RESULT_SIZE", 1 << 23) // 8 MiB
233+
env_config("FUNCTION_MAX_RESULT_SIZE", 1 << 24) // 16 MiB
234234
});
235235

236236
/// When a function exceeds FUNCTION_LIMIT_WARNING_RATIO * a corresponding
@@ -266,8 +266,8 @@ pub static TRANSACTION_MAX_SCHEDULED_TOTAL_ARGUMENT_SIZE_BYTES: LazyLock<usize>
266266
LazyLock::new(|| {
267267
env_config(
268268
"TRANSACTION_MAX_SCHEDULED_TOTAL_ARGUMENT_SIZE_BYTES",
269-
1 << 23,
270-
) // 8 MiB
269+
1 << 24,
270+
) // 16 MiB
271271
});
272272

273273
/// Number of scheduled jobs that can execute in parallel.

crates/isolate/src/tests/adversarial.rs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -504,56 +504,56 @@ async fn test_writes_many(rt: TestRuntime) -> anyhow::Result<()> {
504504
#[convex_macro::test_runtime]
505505
async fn test_query_args_too_big(rt: TestRuntime) -> anyhow::Result<()> {
506506
let t = UdfTest::default(rt).await?;
507-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 9_000_000])?);
507+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 17_000_000])?);
508508
let e = t
509509
.query_js_error("basic:readTime", assert_obj!("data" => data))
510510
.await?;
511511
assert_contains(
512512
&e,
513-
"Arguments for basic.js:readTime are too large (actual: 8.58 MiB, limit: 8 MiB)",
513+
"Arguments for basic.js:readTime are too large (actual: 16.21 MiB, limit: 16 MiB)",
514514
);
515515
Ok(())
516516
}
517517

518518
#[convex_macro::test_runtime]
519519
async fn test_mutation_args_too_big(rt: TestRuntime) -> anyhow::Result<()> {
520520
let t = UdfTest::default(rt).await?;
521-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 9_000_000])?);
521+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 17_000_000])?);
522522
let e = t
523523
.mutation_js_error("basic:simpleMutation", assert_obj!("data" => data))
524524
.await?;
525525
assert_contains(
526526
&e,
527-
"Arguments for basic.js:simpleMutation are too large (actual: 8.58 MiB, limit: 8 MiB)",
527+
"Arguments for basic.js:simpleMutation are too large (actual: 16.21 MiB, limit: 16 MiB)",
528528
);
529529
Ok(())
530530
}
531531

532532
#[convex_macro::test_runtime]
533533
async fn test_action_args_too_big(rt: TestRuntime) -> anyhow::Result<()> {
534534
let t = UdfTest::default(rt).await?;
535-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 9_000_000])?);
535+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 17_000_000])?);
536536
let e = t
537537
.action_js_error("basic:simpleAction", assert_obj!("data" => data))
538538
.await?;
539539
assert_contains(
540540
&e,
541-
"Arguments for basic.js:simpleAction are too large (actual: 8.58 MiB, limit: 8 MiB)",
541+
"Arguments for basic.js:simpleAction are too large (actual: 16.21 MiB, limit: 16 MiB)",
542542
);
543543
Ok(())
544544
}
545545

546546
#[convex_macro::test_runtime]
547547
async fn test_query_args_big(rt: TestRuntime) -> anyhow::Result<()> {
548548
let t = UdfTest::default(rt).await?;
549-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 8_000_000])?);
549+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 16_000_000])?);
550550
let mut log_lines = t
551551
.query_log_lines("basic:readTime", assert_obj!("data" => data))
552552
.await?;
553553
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
554554
assert_contains(
555555
&last_line,
556-
"[WARN] Large size of the function arguments (actual: 8000011 bytes, limit: 8388608 \
556+
"[WARN] Large size of the function arguments (actual: 16000011 bytes, limit: 16777216 \
557557
bytes).",
558558
);
559559
Ok(())
@@ -562,14 +562,14 @@ async fn test_query_args_big(rt: TestRuntime) -> anyhow::Result<()> {
562562
#[convex_macro::test_runtime]
563563
async fn test_mutation_args_big(rt: TestRuntime) -> anyhow::Result<()> {
564564
let t = UdfTest::default(rt).await?;
565-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 8_000_000])?);
565+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 16_000_000])?);
566566
let mut log_lines = t
567567
.mutation_log_lines("basic:simpleMutation", assert_obj!("data" => data))
568568
.await?;
569569
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
570570
assert_contains(
571571
&last_line,
572-
"[WARN] Large size of the function arguments (actual: 8000011 bytes, limit: 8388608 \
572+
"[WARN] Large size of the function arguments (actual: 16000011 bytes, limit: 16777216 \
573573
bytes).",
574574
);
575575
Ok(())
@@ -578,14 +578,15 @@ async fn test_mutation_args_big(rt: TestRuntime) -> anyhow::Result<()> {
578578
#[convex_macro::test_runtime]
579579
async fn test_action_args_big(rt: TestRuntime) -> anyhow::Result<()> {
580580
let t = UdfTest::default(rt).await?;
581-
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 8_000_000])?);
581+
let data: ConvexValue = ConvexValue::Bytes(ConvexBytes::try_from(vec![0; 16_000_000])?);
582582
let mut log_lines = t
583583
.action_log_lines("basic:simpleAction", assert_obj!("data" => data))
584584
.await?;
585585
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
586586
assert_contains(
587587
&last_line,
588-
"[WARN] Large size of the action arguments (actual: 8000011 bytes, limit: 8388608 bytes).",
588+
"[WARN] Large size of the action arguments (actual: 16000011 bytes, limit: 16777216 \
589+
bytes).",
589590
);
590591
Ok(())
591592
}
@@ -596,13 +597,13 @@ async fn test_query_result_too_big(rt: TestRuntime) -> anyhow::Result<()> {
596597
let e = t
597598
.query_js_error(
598599
"adversarial:queryResultSized",
599-
assert_obj!("size" => 9_000_000.0),
600+
assert_obj!("size" => 17_000_000.0),
600601
)
601602
.await?;
602603
assert_contains(
603604
&e,
604-
"Function adversarial.js:queryResultSized return value is too large (actual: 8.58 MiB, \
605-
limit: 8 MiB)",
605+
"Function adversarial.js:queryResultSized return value is too large (actual: 16.21 MiB, \
606+
limit: 16 MiB)",
606607
);
607608
Ok(())
608609
}
@@ -613,13 +614,13 @@ async fn test_mutation_result_too_big(rt: TestRuntime) -> anyhow::Result<()> {
613614
let e = t
614615
.mutation_js_error(
615616
"adversarial:mutationResultSized",
616-
assert_obj!("size" => 9_000_000.0),
617+
assert_obj!("size" => 17_000_000.0),
617618
)
618619
.await?;
619620
assert_contains(
620621
&e,
621-
"Function adversarial.js:mutationResultSized return value is too large (actual: 8.58 MiB, \
622-
limit: 8 MiB)",
622+
"Function adversarial.js:mutationResultSized return value is too large (actual: 16.21 \
623+
MiB, limit: 16 MiB)",
623624
);
624625
Ok(())
625626
}
@@ -630,13 +631,13 @@ async fn test_action_result_too_big(rt: TestRuntime) -> anyhow::Result<()> {
630631
let e = t
631632
.action_js_error(
632633
"adversarial:actionResultSized",
633-
assert_obj!("size" => 9_000_000.0),
634+
assert_obj!("size" => 17_000_000.0),
634635
)
635636
.await?;
636637
assert_contains(
637638
&e,
638-
"Function adversarial.js:actionResultSized return value is too large (actual: 8.58 MiB, \
639-
limit: 8 MiB)",
639+
"Function adversarial.js:actionResultSized return value is too large (actual: 16.21 MiB, \
640+
limit: 16 MiB)",
640641
);
641642
Ok(())
642643
}
@@ -647,13 +648,13 @@ async fn test_query_result_big(rt: TestRuntime) -> anyhow::Result<()> {
647648
let mut log_lines = t
648649
.query_log_lines(
649650
"adversarial:queryResultSized",
650-
assert_obj!("size" => 8_000_000.0),
651+
assert_obj!("size" => 16_000_000.0),
651652
)
652653
.await?;
653654
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
654655
assert_contains(
655656
&last_line,
656-
"[WARN] Large size of the function return value (actual: 8000002 bytes, limit: 8388608 \
657+
"[WARN] Large size of the function return value (actual: 16000002 bytes, limit: 16777216 \
657658
bytes).",
658659
);
659660
Ok(())
@@ -665,13 +666,13 @@ async fn test_mutation_result_big(rt: TestRuntime) -> anyhow::Result<()> {
665666
let mut log_lines = t
666667
.mutation_log_lines(
667668
"adversarial:mutationResultSized",
668-
assert_obj!("size" => 8_000_000.0),
669+
assert_obj!("size" => 16_000_000.0),
669670
)
670671
.await?;
671672
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
672673
assert_contains(
673674
&last_line,
674-
"[WARN] Large size of the function return value (actual: 8000002 bytes, limit: 8388608 \
675+
"[WARN] Large size of the function return value (actual: 16000002 bytes, limit: 16777216 \
675676
bytes).",
676677
);
677678
Ok(())
@@ -683,13 +684,13 @@ async fn test_action_result_big(rt: TestRuntime) -> anyhow::Result<()> {
683684
let mut log_lines = t
684685
.action_log_lines(
685686
"adversarial:actionResultSized",
686-
assert_obj!("size" => 8_000_000.0),
687+
assert_obj!("size" => 16_000_000.0),
687688
)
688689
.await?;
689690
let last_line = log_lines.pop().unwrap().to_pretty_string_test_only();
690691
assert_contains(
691692
&last_line,
692-
"[WARN] Large size of the action return value (actual: 8000002 bytes, limit: 8388608 \
693+
"[WARN] Large size of the action return value (actual: 16000002 bytes, limit: 16777216 \
693694
bytes).",
694695
);
695696
Ok(())

crates/isolate/src/tests/scheduler.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ async fn test_schedule_arguments_too_large(rt: TestRuntime) -> anyhow::Result<()
262262
)
263263
.await?;
264264

265-
// Scheduling a hundred functions with 100KB arguments should not.
265+
// Scheduling a hundred functions with 200KB arguments should not.
266266
let bytes_100k = {
267-
let mut bytes = [0u8; 100 * 1024];
267+
let mut bytes = [0u8; 2 * 100 * 1024];
268268
rng.fill_bytes(&mut bytes);
269269
bytes.to_vec()
270270
};
@@ -290,16 +290,16 @@ async fn test_schedule_arguments_too_large(rt: TestRuntime) -> anyhow::Result<()
290290
async fn test_schedule_arguments_large(rt: TestRuntime) -> anyhow::Result<()> {
291291
UdfTest::run_test_with_isolate2(rt, async move |t: UdfTestType| {
292292
let mut rng = t.rt.rng();
293-
let bytes_1m = {
294-
let mut bytes = [0u8; 1000 * 1024];
293+
let bytes_2m = {
294+
let mut bytes = [0u8; 2 * 1000 * 1024];
295295
rng.fill_bytes(&mut bytes);
296296
bytes.to_vec()
297297
};
298298
let mut log_lines = t
299299
.mutation_log_lines(
300300
"scheduler:scheduleMany",
301301
assert_obj!("limit" => 7, "obj" => {
302-
"bytes" => ConvexValue::Bytes(bytes_1m.try_into()?)
302+
"bytes" => ConvexValue::Bytes(bytes_2m.try_into()?)
303303
}),
304304
)
305305
.await?;

0 commit comments

Comments
 (0)