google-deepmind / code_contests

Apache License 2.0
2.04k stars 200 forks source link

SANDBOX VIOLATION #23

Closed wvaughn409 closed 1 year ago

wvaughn409 commented 1 year ago

UPDATE was able to resolve the by following responses after this post:

https://github.com/deepmind/code_contests/issues/12#issuecomment-1075331768


I had this working at one point, but now when I try to run the solve, it omits the actual code solution that was previously outputted to log. I'm guessing this is due to "Stack traces have been disabled":

` bazel run -c opt execution:solve_example -- --valid_path=//root/tmp/dm-code_contests/code_contests_valid.riegeli --python3_path=/usr/bin/python3.10 --python3_library_paths=/usr/lib/python3.10 DEBUG: Rule 'com_github_grpc_grpc' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "96b73272eadc01afb5fb45b92b408c47e4387274", shallow_since = "1624063996 -0700" and dropping ["tag"] DEBUG: Repository com_github_grpc_grpc instantiated at: /root/WORKSPACE:4:15: in Repository rule git_repository defined at: /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_sandboxed_api' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1645093884 -0800" DEBUG: Repository com_google_sandboxed_api instantiated at: /root/WORKSPACE:109:6: in /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe Repository rule git_repository defined at: /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "cc7b1b53234cd7a8f50d90ac3933b240dcf4cd97", shallow_since = "1641866895 -0800" and dropping ["tag"] DEBUG: Repository com_google_protobuf instantiated at: /root/WORKSPACE:22:15: in Repository rule git_repository defined at: /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_absl' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "215105818dfde3174fe799600bb0f3cae233d0bf", shallow_since = "1635953174 -0400" and dropping ["tag"] DEBUG: Repository com_google_absl instantiated at: /root/WORKSPACE:28:15: in Repository rule git_repository defined at: /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'rules_python' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "76ef44fdb8aaa8d5c607721ffe1b1cbf1e8f08dd", shallow_since = "1635214215 -0700" and dropping ["tag"] DEBUG: Repository rules_python instantiated at: /root/WORKSPACE:14:15: in Repository rule git_repository defined at: /root/.cache/bazel/_bazel_root/887904812217cca9bc2b9adb875daf42/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in INFO: Analyzed target //execution:solve_example (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //execution:solve_example up-to-date: bazel-bin/execution/solve_example INFO: Elapsed time: 0.319s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Running command line: bazel-bin/execution/solve_example '--valid_path=//root/tmp/dm-code_contests/code_contests_valid.riegeli' '--python3_path=/usr/bin/python3.10' '--python3_librarINFO: Build completed successfully, 1 total action We will try to solve "Gregor and Cryptography": https://codeforces.com/problemset/problem/1549/A

We will run:

  1. A program that does not compile.
  2. A program that runs successfully, but gives the wrong answer sometimes.
  3. A correct solution.

An invalid program is reported as not compiling:

[global_forkclient.cc : 122] RAW: Starting global forkserver WARNING: Logging before InitGoogleLogging() is written to STDERR E20220922 03:16:46.685678 473369 monitor.cc:842] SANDBOX VIOLATION : PID: 473374, PROG: 'python3.10' : [X86-64] arch_prctl [158](0x3001 [12289], 0x7ffe03026890) IP: 0x7fb5e9583bf5, STACK: 0x7ffe03026840 I20220922 03:16:46.685863 473369 monitor.cc:386] Stack traces have been disabled Compilation failed


The bad solution passes a few tests but then fails. Because we set stop_on_first_failure to True, we stop once we see a failure. We are running on 4 threads, so it's possible that more than one failure occurs before all threads stop.

E20220922 03:16:46.965130 473376 monitor.cc:842] SANDBOX VIOLATION : PID: 473379, PROG: 'python3.10' : [X86-64] arch_prctl [158](0x3001 [12289], 0x7ffd0c9893d0) IP: 0x7f4a0ad42bf5, STACK: 0x7ffd0c989380 I20220922 03:16:46.965252 473376 monitor.cc:386] Stack traces have been disabled Compilation failed


The good solution passes all tests.

E20220922 03:16:47.242813 473384 monitor.cc:842] SANDBOX VIOLATION : PID: 473387, PROG: 'python3.10' : [X86-64] arch_prctl [158](0x3001 [12289], 0x7ffe72cfa5f0) IP: 0x7f8b25f09bf5, STACK: 0x7ffe72cfa5a0 I20220922 03:16:47.242944 473384 monitor.cc:386] Stack traces have been disabled Compilation failed`

wvaughn409 commented 1 year ago

was able to resolve the by following responses after this post:

https://github.com/deepmind/code_contests/issues/12#issuecomment-1075331768

wvaughn409 commented 1 year ago

Resolution: https://github.com/deepmind/code_contests/issues/12#issuecomment-1075331768

Now getting the correct output: `bazel run -c opt execution:solve_example -- --valid_path=/tmp/dm-code_contests/code_contests_valid.riegeli DEBUG: Rule 'com_github_grpc_grpc' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "96b73272eadc01afb5fb45b92b408c47e4387274", shallow_since = "1624063996 -0700" and dropping ["tag"] DEBUG: Repository com_github_grpc_grpc instantiated at: /home/gitlab/code_contests/WORKSPACE:4:15: in Repository rule git_repository defined at: /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_sandboxed_api' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1645093884 -0800" DEBUG: Repository com_google_sandboxed_api instantiated at: /home/gitlab/code_contests/WORKSPACE:109:6: in /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/utils.bzl:233:18: in maybe Repository rule git_repository defined at: /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_protobuf' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "cc7b1b53234cd7a8f50d90ac3933b240dcf4cd97", shallow_since = "1641866895 -0800" and dropping ["tag"] DEBUG: Repository com_google_protobuf instantiated at: /home/gitlab/code_contests/WORKSPACE:22:15: in Repository rule git_repository defined at: /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'com_google_absl' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "215105818dfde3174fe799600bb0f3cae233d0bf", shallow_since = "1635953174 -0400" and dropping ["tag"] DEBUG: Repository com_google_absl instantiated at: /home/gitlab/code_contests/WORKSPACE:28:15: in Repository rule git_repository defined at: /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in DEBUG: Rule 'rules_python' indicated that a canonical reproducible form can be obtained by modifying arguments commit = "76ef44fdb8aaa8d5c607721ffe1b1cbf1e8f08dd", shallow_since = "1635214215 -0700" and dropping ["tag"] DEBUG: Repository rules_python instantiated at: /home/gitlab/code_contests/WORKSPACE:14:15: in Repository rule git_repository defined at: /home/gitlab/.cache/bazel/_bazel_gitlab/a7d5da11616e839ae2061597598e3127/external/bazel_tools/tools/build_defs/repo/git.bzl:199:33: in INFO: Analyzed target //execution:solve_example (0 packages loaded, 0 targets configured). INFO: Found 1 target... Target //execution:solve_example up-to-date: bazel-bin/execution/solve_example INFO: Elapsed time: 0.216s, Critical Path: 0.00s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Build completed successfully, 1 total action We will try to solve "Gregor and Cryptography": https://codeforces.com/problemset/problem/1549/A

We will run:

  1. A program that does not compile.
  2. A program that runs successfully, but gives the wrong answer sometimes.
  3. A correct solution.

An invalid program is reported as not compiling:

[global_forkclient.cc : 122] RAW: Starting global forkserver Compilation failed


The bad solution passes a few tests but then fails. Because we set stop_on_first_failure to True, we stop once we see a failure. We are running on 4 threads, so it's possible that more than one failure occurs before all threads stop.

Compilation succeeded Test 0 passed. Test 1 passed. Test 2 failed. Test 3 passed. Test 4 failed. Test 5 passed. Test 6 failed. Test 7 did not run. Test 8 did not run. Test 9 did not run.


The good solution passes all tests.

Compilation succeeded Test 0 passed. Test 1 passed. Test 2 passed. Test 3 passed. Test 4 passed. Test 5 passed. Test 6 passed. Test 7 passed. Test 8 passed. Test 9 passed.`