Git Product home page Git Product logo

Comments (9)

Zard-C avatar Zard-C commented on June 24, 2024

Hello @Chaochao0215, maybe we could build a debug type of this source code and use gdb to backtrace when it crashed

from rclcpp.

Barry-Xu-2018 avatar Barry-Xu-2018 commented on June 24, 2024

I tried your code, but I cannot find segment fault.
My test environment is based on ros2 Debian package (ros-humble-rclcpp 16.0.8-1jammy.20240217.065743).

from rclcpp.

Chaochao0215 avatar Chaochao0215 commented on June 24, 2024

Hello @Chaochao0215, maybe we could build a debug type of this source code and use gdb to backtrace when it crashed
Glad to receive your reply, this issue reoccuered and i pasted the backtrace information
HowHgpAxRD

from rclcpp.

Zard-C avatar Zard-C commented on June 24, 2024

I tried your code and I can't reproduce the segment fault.
However, in gdb backtrace it seems like a multi-thread problem,
rebuild your program with

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -g")

and check if there's data race in ThreadSanitizer report.

from rclcpp.

Chaochao0215 avatar Chaochao0215 commented on June 24, 2024

I tried your code and I can't reproduce the segment fault. However, in gdb backtrace it seems like a multi-thread problem, rebuild your program with

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -g")

and check if there's data race in ThreadSanitizer report.

hi, I found a quick way to reproduce the problem

  1. set breakpoint 1 at line 21 of the test file
  2. set breakpoint 2 at line 25 of the test file
  3. set breakpoint 3 at " rcl_ret_t status =
    rcl_wait(&wait_set_, std::chrono::duration_caststd::chrono::nanoseconds(timeout).count());" in executor.cpp
  4. set gdb to not stop when hit breakpoints , then run the test
  5. after breakpoints 1 && 3 both hit , continue the main thread and wait to hit breakpoint 2
  6. after breakpoint 2 hit, send the message subscribed in the new shell terminal, such as 'ros2 topic pub /test_callback_group std_msgs/msg/String "data: hello"' and continue the thread interrupted at breakpoint 3 , segment fault should occurred

from rclcpp.

Zard-C avatar Zard-C commented on June 24, 2024

6. send the message subscribed in the new shell terminal, such as 'ros2 topic pub /test_callback_group std_msgs/msg/String "data: hello"

I missed this step.

from rclcpp.

Chaochao0215 avatar Chaochao0215 commented on June 24, 2024
  1. send the message subscribed in the new shell terminal, such as 'ros2 topic pub /test_callback_group std_msgs/msg/String "data: hello"

I missed this step.

I'm sorry i didn't specify the need to publish message at the beginning, hope you reproduce it successfully.

from rclcpp.

Chaochao0215 avatar Chaochao0215 commented on June 24, 2024

I tried your code, but I cannot find segment fault. My test environment is based on ros2 Debian package (ros-humble-rclcpp 16.0.8-1jammy.20240217.065743).
Thank you for your attention, it occurs with low probability and I built ROS2 from source so that it can be controlled through gdb

from rclcpp.

fujitatomoya avatar fujitatomoya commented on June 24, 2024

@Chaochao0215 it would be helpful if you could provide self-contained reproducible test.

from rclcpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.