Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get stacktrace with debug infomation in ComputationContainer #12

Closed
arukuka opened this issue Aug 18, 2022 · 3 comments · Fixed by #10
Closed

Unable to get stacktrace with debug infomation in ComputationContainer #12

arukuka opened this issue Aug 18, 2022 · 3 comments · Fixed by #10
Assignees

Comments

@arukuka
Copy link
Member

arukuka commented Aug 18, 2022

Logger qmpc::Log::Debug needs to print information about the place which calls this function via boost::stacktrace.
However, it prints only address and binary file location at the moment.
This issue could be reproduced with a following patch.

  • patch
    diff --git a/src/ComputationContainer/ConfigParse/ConfigParse.hpp b/src/ComputationContainer/ConfigParse/ConfigParse.hpp
    index 5e4647c4..28324e8c 100644
    --- a/src/ComputationContainer/ConfigParse/ConfigParse.hpp
    +++ b/src/ComputationContainer/ConfigParse/ConfigParse.hpp
    @@ -83,6 +83,7 @@ class Config
    
        Config()
        {
    +        qmpc::Log::Debug(__FILE__, __LINE__);
            party_id = getEnvInt("PARTY_ID");
            n_parties = getEnvInt("N_PARTIES");
            sp_id = getEnvInt("SP_ID");
  • result
    root@dae2cfbfc368:/QuickMPC# ./bazel-bin/computation_container
    2022-08-18 04:28:28+0000|DEBUG|0x00005649CF12504B in ./bazel-bin/computation_container|./ConfigParse/ConfigParse.hpp|86
    ...

We referred to the following document for how to use "boost::stacktrace".

We confirmed that a stack trace can be obtained with a simple program without using bazel.

@arukuka arukuka self-assigned this Aug 18, 2022
@arukuka
Copy link
Member Author

arukuka commented Aug 18, 2022

@arukuka
Copy link
Member Author

arukuka commented Aug 18, 2022

Fixed --spawn_strategy=local --strip=never backtrace
o o o o
o x o o
x x x o
x x o x

@arukuka
Copy link
Member Author

arukuka commented Aug 18, 2022

This issue can be resolved if src/ComputationContainer/ComputationParty/BUILD has following configuration.

diff --git a/src/ComputationContainer/ComputationParty/BUILD b/src/ComputationContainer/ComputationParty/BUILD
index 6f956f6c..3d1f8aef 100644
--- a/src/ComputationContainer/ComputationParty/BUILD
+++ b/src/ComputationContainer/ComputationParty/BUILD
@@ -14,5 +14,8 @@ cc_library(
         "//Job:jobManager",
         "//LogHeader:logger",
     ],
+    linkopts=["-lboost_stacktrace_backtrace", "-ldl", "-lbacktrace"],
+    defines=["BOOST_STACKTRACE_LINK",
+        "BOOST_STACKTRACE_USE_BACKTRACE"],
     visibility = ["//visibility:public"],
 )

I checked the difference of bazel-bin/computation_container-2.params before and after applying the above patch.
bazel-bin/computation_container-2.params is used for link option, it could be checked by bazel build -s //:computation_container.
Then, I found a setting in a place not related to logging.

linkopts=["-lboost_stacktrace_addr2line"],
defines=["BOOST_STACKTRACE_LINK",
"BOOST_STACKTRACE_USE_ADDR2LINE"],

Removing this one, the configuration in src/ComputationContainer/ComputationParty/BUILD above is no longer needed.

@arukuka arukuka linked a pull request Aug 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant