Comments (9)
Are you trying to limit the address space of the JVM? Don't do that, they assume they are able to use a lot of virtual memory when running. Limit the maximum resident memory instead.
from isolate.
Well I also provided --mem option in isolate, does that limit the max RSS? Also why are limiting stack size and heap size through JVM options not recommended?
My primary goal is to make java program run (by any way / without limits) and I haven't succeeded it through isolate yet
from isolate.
--mem
limits the address space, as documented here. You want to use --cg-mem
to limit the resident memory. I advise you to never use --mem
, it's most of the time useless to limit the address space of the programs you're running, except maybe for programs that don't do a lot of virtual memory mapping.
from isolate.
Thanks a lot! Let me post a followup comment after i try it
from isolate.
For reference, here's how we use Java in CMS: https://github.com/cms-dev/cms/blob/master/cms/grading/languages/java_jdk.py
from isolate.
I'm still getting the same exception even though I haven't made any resource limits and just ran java -version
$ isolate --init # o.k.
$ isolate --run -- /usr/bin/java -version # error
The error occurs immediately after I enter the command and error message is identical as the one in gist link above
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# Can not save log file, dump to screen..
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Cannot create GC thread. Out of system resources.
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (gcTaskThread.cpp:48), pid=2, tid=0x00002b451f523b88
#
# JRE version: (8.0_151-b12) (build )
# Java VM: OpenJDK 64-Bit Server VM (25.151-b12 mixed mode linux-amd64 compressed oops)
# Derivative: IcedTea 3.6.0
# Distribution: Custom build (Tue Nov 21 11:22:36 GMT 2017)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
Some other notes...
- Docker image is based on
openjdk/8u151-jdk-alpine3.7
, running in privileged mode - It works well if I just run
/usr/bin/java -version
without isolate. - Specifying following JVM options yielded same results
- GC Thread options
-XX:ParallelGCThreads=2
- Reserved code cache size option
-XX:ReservedCodeCacheSize=16M
- Heap and stack size option
Xss??M
,Xmx??M
- GC Thread options
ulimit -a
inside the container (not isolate sandbox) gives you the following result
-f: file size (blocks) unlimited
-t: cpu time (seconds) unlimited
-d: data seg size (kb) unlimited
-s: stack size (kb) 8192
-c: core file size (blocks) 0
-m: resident set size (kb) unlimited
-l: locked memory (kb) 82000
-p: processes unlimited
-n: file descriptors 1048576
-v: address space (kb) unlimited
-w: locks unlimited
-e: scheduling priority 0
-r: real-time priority 0
from isolate.
Well, it worked after I set --processes=X
where X >= 11
I'm trying to figure out why so much default processes are required (even if I specify -XX:ParallelGCThreads=1
) but finally it worked
from isolate.
I was going to say one of the pitfalls of isolate is running it without options thinking it won't add any restrictions, because the --processes
option is the only one that have a limit by default.
I'd strongly advise to never use --processes
to isolate the JVM, as the errors it will produce will be very very hard to see. At some point, we had Java just hang without dumping any state to stderr, and we couldn't debug the issue at all until I just randomly bumped the process limit from 20 to 100 and it worked.
There are not only GC threads, also JIT compilation threads, you can also specify ConcGCThreads etc... Java is just really bad at being isolated (https://jaxenter.com/nobody-puts-java-container-139373.html) either because of the number of processes required, or because of its habit of looking at the available physical RAM to see how much virtual memory it is going to allocate (it's really a percentage of the total RAM...).
For what it's worth, it's supposed to be better in Java 10: https://blog.docker.com/2018/04/improved-docker-container-integration-with-java-10/
from isolate.
from isolate.
Related Issues (20)
- "No such file or directory" issue when trying to run C# program using Dotnet HOT 7
- Memory corruption bug in cg_init HOT 2
- C# program failed to compile using mcs - error CS2001: Source file `Main.cs' could not be found HOT 1
- make install exited with error code 1. HOT 1
- Error Running isolate in Ubuntu:22.04 with Systemd HOT 10
- Support for Docker HOT 12
- Error using isolate HOT 15
- Assertion Failure Issue HOT 4
- --as-uid and --as-gid seem to be not usable in Docker container HOT 3
- Cannot set disk quota: No such process HOT 1
- chown: cannot access /var/local/lib/isolate/XX/box': No such file or directory HOT 6
- CPU time (--time) consumed in subsequent runs in the same box with cg (cgroup2) enabled HOT 15
- Limitation on number of sandboxes HOT 1
- [Query] Isolate Mac OS setup HOT 1
- Unable to build manual HOT 3
- CGoups not found HOT 5
- isolate: unrecognized option '--cg-timing' and annot open /run/isolate/cgroup: No such file or directory HOT 2
- Cannot create subgroup /sys/fs/cgroup/isolate.slice/isolate.service/daemon: No such file or directory HOT 12
- Memory access violation leads to different outcomes in different envrionments HOT 2
- Measuring time and memory usage with --cg option HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isolate.