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
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ As an example, an antipattern would be to implement a third party interface and
182
182
183
183
The ISOLATED and UNTRUSTED sandbox policies require setting resource limits for a context.
184
184
Different configurations can be provided for each context.
185
-
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()`.
185
+
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()`.
186
186
At this point, no more guest code can be executed in the context
187
187
188
188
The `--sandbox.TraceLimits` option allows you to trace guest code and record the maximum resource utilization.
@@ -232,7 +232,7 @@ Certain limits can be [reset](#resetting-resource-limits) at any point of time d
232
232
233
233
The `sandbox.MaxCPUTime` option allows you to specify the maximum CPU time spent running guest code.
234
234
CPU time spent depends on the underlying hardware.
235
-
The maximum [CPU time](https://docs.oracle.com/en/java/javase/17/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.
235
+
The maximum [CPU time](https://docs.oracle.com/en/java/javase/21/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.
236
236
By default the time limit is checked every 10 milliseconds.
237
237
This can be customized using the `sandbox.MaxCPUTimeCheckInterval` option.
238
238
@@ -247,7 +247,7 @@ This can mean that if two threads execute the same context then the time limit w
247
247
248
248
The time limit is enforced by a separate high-priority thread that will be woken regularly.
249
249
There is no guarantee that the context will be cancelled within the accuracy specified.
250
-
The accuracy may be significantly missed, e.g. if the host VM causes a full garbage collection.
250
+
The accuracy may be significantly missed, for example, if the host VM causes a full garbage collection.
251
251
If the time limit is never exceeded then the throughput of the guest context is not affected.
252
252
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.
253
253
@@ -347,8 +347,8 @@ The limit is checked by retained size computation triggered either based on [all
347
347
The allocated bytes are checked by a separate high-priority thread that will be woken regularly.
348
348
There is one such thread for each memory-limited context (one with `sandbox.MaxHeapMemory` set).
349
349
The retained bytes computation is done by yet another high-priority thread that is started from the allocated bytes checking thread as needed.
350
-
The retained bytes computation thread also cancels the context if the heap memory limit is exeeded.
351
-
Additionaly, when the low memory trigger is invoked, all contexts on engines with at least one memory-limited context are paused together with their allocation checkers.
350
+
The retained bytes computation thread also cancels the context if the heap memory limit is exceeded.
351
+
Additionally, when the low memory trigger is invoked, all memory-limited contexts are paused together with their allocation checkers.
352
352
All individual retained size computations are cancelled.
353
353
Retained bytes in the heap for each memory-limited context are computed by a single high-priority thread.
354
354
@@ -376,8 +376,8 @@ This can be configured by the `sandbox.RetainedBytesCheckInterval` option. The i
376
376
The allocated bytes checking for a context can be disabled by the `sandbox.AllocatedBytesCheckEnabled` option.
377
377
By default it is enabled ("true"). If disabled ("false"), retained size checking for the context can be triggered only by the low memory trigger.
378
378
379
-
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/17/docs/api/java.management/java/lang/management/MemoryMXBean.html) is invoked and initiates the following process.
380
-
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 cancelled, and then the execution is resumed.
379
+
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/21/docs/api/java.management/java/lang/management/MemoryMXBean.html) is invoked and initiates the following process.
380
+
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.
381
381
The default factor is 0.7. This can be configured by the `sandbox.RetainedBytesCheckFactor` option.
382
382
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