How do you debug sandbox when build fails but running the command passes

702 views
Skip to first unread message

Indra Gunawan

unread,
Jun 27, 2018, 2:28:06 PM6/27/18
to bazel-discuss
To Bazel users,

I am trying to run shell command using ctx.actions.run_shell or ctx.action a python wrapper script like below:

    ctx.actions.run_shell(
        inputs=cython_gen_inputs,
        outputs=cython_gen_outputs,
        command=cython_gen_cmd,
        progress_message="Generating cython generated files",
        env={"LD_LIBRARY_PATH": python3_host_dir,
             "PYTHONHOME": python3_host_home,
             "PYTHONPATH": python3_host_lib,
             "CYTHON_ROOT": cython_root},
    )

building a target above with --sandbox_debug --verbose_failures flags.

The build fails but if I copy and paste the command reported as failure it works.  The return status is 0 while the build by bazel returns 1.

What else can I do further to debug the error?

Thank you

Marcel Hlopko

unread,
Jun 28, 2018, 3:45:25 AM6/28/18
to Indra Gunawan, bazel-discuss
Are you running everything including parens and that passes, and when bazel runs it it doesn't? Can you assemble a repro?

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/e2fbca72-43c1-43e0-b4ae-0229351519f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Marcel Hlopko | Software Engineer | hlo...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

Austin Schuh

unread,
Jun 28, 2018, 2:04:44 PM6/28/18
to Marcel Hlopko, Indra Gunawan, bazel-discuss
This sounds like something is not available when running in the sandbox that is required.

As another trick in your bag of tricks, I've also added strace to the command invocation from bazel and diffed the output.  That lets me see what each invocation is doing differently in it's interactions with the OS, and pinpoint when the flow of execution diverges.

Austin

Reply all
Reply to author
Forward
0 new messages