bazel test fails but directly running the generated binary pass.

1,669 views
Skip to first unread message

Baijun Wu

unread,
Dec 8, 2021, 2:00:50 PM12/8/21
to bazel-discuss
Hello,

I have a weird problem when open sourcing our work as a bazel project. One of the test fails when running "bazel test -c opt :xyz". The error message says "*** buffer overflow detected ***: terminated". However, when I try "bazel test :xyz", it passes. 

I try to debug the potential memory issue directly by running the generated binary ("bazel build -c opt :xyz") under bazel-bin. But it can pass as well. 

Could you please help me understand what is the difference between running "bazel test -c opt :xyz" and directly running "bazel-bin/my_project/xyz"?  Thanks a lot!

Austin Schuh

unread,
Dec 9, 2021, 1:42:33 AM12/9/21
to Baijun Wu, bazel-discuss
Shot in the dark, but check your ulimits in both situations.  This smells like a stack overflow problem.

A hack I've used in the past is to put a sleep 30 at the top of my test and then quickly attach GDB to the test process to catch the failure in the act.

Depending on how bazel is setup, you are running under one of the sandboxes.  They provide different levels of sandboxing.  --sandbox_debug will print out a ton more details about how that is being run, and should give you enough info to actually reproduce the failure.

Good luck!
Austin

--
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/f8f6cefb-b2d8-4427-a907-ce9c9643fe00n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages