GithubHelp home page GithubHelp logo

Comments (10)

k-okada avatar k-okada commented on August 22, 2024

Thank you for detailed report. I just noticed that your example code works, if we changed to

  ros::init(argc, argv, "TestClient");
 // SecondArgument of SimpleActionClient means "spin_thread", so we do not need this http://docs.ros.org/melodic/api/actionlib/html/classactionlib_1_1SimpleActionClient.html#a47b97ba81c538372b6f128ed8b285fbc
 //  boost::thread spin_thread(&spinThread);

 // we may not need to instantiate ActionClient every loop
    actionlib::SimpleActionClient<control_msgs::FollowJointTrajectoryAction> ac("follow_joint_trajectory_action", true);
    ac.waitForServer();
  while (ros::ok())
  {
    ac.sendGoal(goal);
...
  }
  ros::shutdown();
 //  spin_thread.join();

Do you have any good reason to start your spin_thread and initialize ac every time?

from actionlib.

k-sawa avatar k-sawa commented on August 22, 2024

Thank you for testing and comment my code.
I'm concerned that the topic subscribing error occurs at node initializing or not.
Creation of an actionlib client instance, in the loop every time is not this issue's Essense.
Is it better for the testing cycle of the test node launching and exit?

from actionlib.

k-sawa avatar k-sawa commented on August 22, 2024

Sorry I accidentally closed this, so I reopen one.

from actionlib.

k-okada avatar k-okada commented on August 22, 2024

from actionlib.

k-sawa avatar k-sawa commented on August 22, 2024

There is no reasonable reason to initializing action client every loop, in the normal use.
I intended to make the loop test code for investigating the initial subscribing behavior of action client.

from actionlib.

k-sawa avatar k-sawa commented on August 22, 2024

As the result of additional investigation, I think it is a reconnection issue of action client.

I made other reproduce program that loops launch of action server and client, and the issue was not reproduced as 13,000 tries. Then tried action client launch and exit only loop, as keep launching action server, it was reproduced twice in 8,609 tries. The code is here.

Reconnection of the action client is assumed to occur occasionally. For example, it may be due to the respawn option of launch file.

from actionlib.

fujitatomoya avatar fujitatomoya commented on August 22, 2024

+1

from actionlib.

jschleicher avatar jschleicher commented on August 22, 2024

This issue probably makes the tests currently flaky, see unstable build for PR #158

14:12:55 [Testcase: testtest_cpp_simple_client] ... ERROR!
14:12:55 ERROR: max time [60.0s] allotted for test [test_cpp_simple_client] of type [actionlib/actionlib-exercise_simple_client]

With additional debug output, it seems like the server receives the goal, but the test node doesn't get the result.

from actionlib.

ndepal avatar ndepal commented on August 22, 2024

I have a roscpp node that has an actionlib SimpleActionClient. During start up, my node calls ac.waitForServer(). This sometimes hangs indefinitely, sometimes it just takes several minutes, despite the ROS node serving the action already being up.

The debug output of the ros.actionlib.ConnectionMonitor logger of the client node shows:

isServerConnected: Client has not yet connected to feedback topic of server

Which is printed here.

Doing a rostopic echo /my_action/feedback does show the server node as the publisher as well as the client node as a subscriber.

Doing a rostopic pub /my_action/feedback ... will get the ac.waitForServer() to complete right away.

Environment

I am running this on ROS melodic. Both server and client are C++ nodes.
roscore, the server and client are each running inside their own Docker containers and communicating over a bridged Docker network. I can rosnode ping each node from every other container, and publishing/subscribing works just fine, so I know the communication between the nodes is fine in principle. The only thing that hangs are the ac.waitForServer() calls.

I have never seen this issue when running the nodes outside of Docker.

from actionlib.

ndepal avatar ndepal commented on August 22, 2024

I think I found out what was causing the issue for me. The issue was that my Docker containers had a much higher nofiles ulimit. Setting this to 1024 (which is what the Ubuntu host OS also has) seems to resolve the issue.

I found the solution thanks to #93 (comment).

I'm guessing something like this is happening moby/moby#38814:

In particular, RLIMIT_NOFILE, a number of open files limit, which is set to 2^20 (aka 1048576), causes a slowdown in a number of programs, as they use the upper limit value to iterate over all potentially opened file descriptors

See also ros/ros_comm#1122

from actionlib.

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.