We currently need to set a very high CODE_JAIL.limits.NPROC for codejail-service, in the area of 2000, otherwise the sudo -u sandbox ... call fails to fork. This is much higher than the limit we actually want to set for a sandbox.
It turns out the issue is that while the NPROC setting constrains only one process, all processes owned by the same UID contribute to the usage count. And Docker does not confine UIDs, just the mapping of usernames to UIDs. If codejail-service runs as the app user in the container with UID 1000, the rlimit system still sees all of the other processes owned by UID 1000 on the host as well, and there are hundreds or even thousands of those.
The best solution we have available is to assign app a UID that does not collide with anything on the host.
Implementation:
We currently need to set a very high
CODE_JAIL.limits.NPROCfor codejail-service, in the area of 2000, otherwise thesudo -u sandbox ...call fails to fork. This is much higher than the limit we actually want to set for a sandbox.It turns out the issue is that while the NPROC setting constrains only one process, all processes owned by the same UID contribute to the usage count. And Docker does not confine UIDs, just the mapping of usernames to UIDs. If codejail-service runs as the
appuser in the container with UID 1000, the rlimit system still sees all of the other processes owned by UID 1000 on the host as well, and there are hundreds or even thousands of those.The best solution we have available is to assign
appa UID that does not collide with anything on the host.Implementation:
appin the Dockerfile to use a new, randomly selected UIDdocs/deployment.rstappuser