You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/security/polyglot-sandbox.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -183,7 +183,7 @@ As an example, an antipattern would be to implement a third party interface and
183
183
184
184
The ISOLATED and UNTRUSTED sandbox policies require setting resource limits for a context.
185
185
Different configurations can be provided for each context.
186
-
If a limit is exceeded, evaluation of the code fails and the context is canceled with a [`PolyglotException`](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/PolyglotException.html) which returns `true` for `isResourceExhausted()`.
186
+
If a limit is exceeded, evaluation of the code fails and the context is cancelled with a [`PolyglotException`](https://www.graalvm.org/sdk/javadoc/org/graalvm/polyglot/PolyglotException.html) which returns `true` for `isResourceExhausted()`.
187
187
At this point, no more guest code can be executed in the context
188
188
189
189
The `--sandbox.TraceLimits` option allows you to trace guest code and record the maximum resource utilization.
@@ -233,7 +233,7 @@ Certain limits can be [reset](#resetting-resource-limits) at any point of time d
233
233
234
234
The `sandbox.MaxCPUTime` option allows you to specify the maximum CPU time spent running guest code.
235
235
CPU time spent depends on the underlying hardware.
236
-
The maximum [CPU time](https://docs.oracle.com/en/java/javase/22/docs/api/java.management/java/lang/management/ThreadMXBean.html#getThreadCpuTime\(long\)) specifies how long a context can be active until it is automatically canceled and the context is closed.
236
+
The maximum [CPU time](https://docs.oracle.com/en/java/javase/22/docs/api/java.management/java/lang/management/ThreadMXBean.html#getThreadCpuTime\(long\)) specifies how long a context can be active until it is automatically cancelled and the context is closed.
237
237
By default the time limit is checked every 10 milliseconds.
238
238
This can be customized using the `sandbox.MaxCPUTimeCheckInterval` option.
239
239
@@ -247,7 +247,7 @@ The CPU time of all threads will be added and checked against the CPU time limit
247
247
This can mean that if two threads execute the same context then the time limit will be exceeded twice as fast.
248
248
249
249
The time limit is enforced by a separate high-priority thread that will be woken regularly.
250
-
There is no guarantee that the context will be canceled within the accuracy specified.
250
+
There is no guarantee that the context will be cancelled within the accuracy specified.
251
251
The accuracy may be significantly missed, for example, if the host VM causes a full garbage collection.
252
252
If the time limit is never exceeded then the throughput of the guest context is not affected.
253
253
If the time limit is exceeded for one context then it may slow down the throughput for other contexts with the same explicit engine temporarily.
Specifies the maximum number of statements a context may execute until it is canceled.
275
+
Specifies the maximum number of statements a context may execute until it is cancelled.
276
276
After the statement limit was triggered for a context, it is no longer usable and every use of the context will throw a `PolyglotException` that returns `true` for `PolyglotException.isCancelled()`.
277
277
The statement limit is independent of the number of threads executing.
278
278
@@ -350,7 +350,7 @@ There is one such thread for each memory-limited context (one with `sandbox.MaxH
350
350
The retained bytes computation is done by yet another high-priority thread that is started from the allocated bytes checking thread as needed.
351
351
The retained bytes computation thread also cancels the context if the heap memory limit is exceeded.
352
352
Additionally, when the low memory trigger is invoked, all memory-limited contexts are paused together with their allocation checkers.
353
-
All individual retained size computations are canceled.
353
+
All individual retained size computations are cancelled.
354
354
Retained bytes in the heap for each memory-limited context are computed by a single high-priority thread.
355
355
356
356
The heap memory limit will not prevent the context from causing `OutOfMemory` errors.
@@ -378,7 +378,7 @@ The allocated bytes checking for a context can be disabled by the `sandbox.Alloc
378
378
By default it is enabled ("true"). If disabled ("false"), retained size checking for the context can be triggered only by the low memory trigger.
379
379
380
380
When the total number of bytes allocated in the heap for the whole host VM exceeds a certain factor of the total heap memory of the VM, [low memory notification](https://docs.oracle.com/en/java/javase/22/docs/api/java.management/java/lang/management/MemoryMXBean.html) is invoked and initiates the following process.
381
-
The execution for all engines with at least one execution context which has the `sandbox.MaxHeapMemory` option setis paused, retained bytes in the heap for each memory-limited context are computed, contexts exceeding their limits are canceled, and then the execution is resumed.
381
+
The execution pauses for all execution contexts where the `sandbox.MaxHeapMemory` option is set. The execution is resumed only when retained bytes in the heap for each memory-limited context are computed and contexts exceeding their limits are cancelled.
382
382
The default factor is 0.7. This can be configured by the `sandbox.RetainedBytesCheckFactor` option.
383
383
The factor must be between 0.0 and 1.0. All contexts using the `sandbox.MaxHeapMemory` option must use the same value for `sandbox.RetainedBytesCheckFactor`.
0 commit comments