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

Using with Ros2: Ros2webbridge crashes after a period of time #376

Closed
3 tasks done
slogan-oxts opened this issue Jan 26, 2021 · 4 comments
Closed
3 tasks done

Using with Ros2: Ros2webbridge crashes after a period of time #376

slogan-oxts opened this issue Jan 26, 2021 · 4 comments

Comments

@slogan-oxts
Copy link

slogan-oxts commented Jan 26, 2021

  • I am at the right place and my issue is directly related to ROS#. General technical questions I would post e.g. at ROS Answers or Stack Overflow. For library-specific questions I would look for help in the corresponding library forums.
  • I have thoroughly read the Contributing Guideline and writing this issue is the right thing to do in my case.

I have a question!

  • I searched the Wiki, open and closed issues for an answer. I tried my best to find the answer by myself without success. I believe that the discussion we will have in this issue, and the solutions we might find, will help me, and likely other community members who have a similar problem.

Here is my question:

  • OS: Windows 10
  • Ros: Ros2 Eloquent
  • Unity: 2019.4.14f1
  • Node.js: 14.15.4

I'm trying to use Ros# with Ros2 using Ros2webbridge.

I get the messages in unity but after a length of time (< 1 minute) after subscribing, Ros2webbridge crashes with the error:

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 000000CFCB4FD850
 1: 00007FF7314F058F napi_wrap+109311
 2: 00007FF731424D8F std::basic_ostream<char,std::char_traits<char> >::operator<<+57151
 3: 00007FF73205E412 V8_Fatal+162
 4: 00007FF731B022AD v8::internal::BackingStore::Reallocate+653
 5: 00007FF731D480E9 v8::ArrayBuffer::GetBackingStore+137
 6: 00007FF7314D2469 napi_get_typedarray_info+393
 7: 00007FF9FA289B41
 8: 00007FF9FA28F28D
 9: 00007FF9FA287EC3
10: 00007FF9FA28EAE3
11: 00007FF7314CCD86 node::Stop+35046
12: 00007FF731D0E72F v8::internal::Builtins::builtin_handle+321471
13: 00007FF731D0DCC4 v8::internal::Builtins::builtin_handle+318804
14: 00007FF731D0DFB7 v8::internal::Builtins::builtin_handle+319559
15: 00007FF731D0DE03 v8::internal::Builtins::builtin_handle+319123
16: 00007FF731DE9F9D v8::internal::SetupIsolateDelegate::SetupHeap+464173
17: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
18: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
19: 00000267A1710CFC

or sometimes:

#
# Fatal error in , line 0
# Check failed: result.second.
#
#
#
#FailureMessage Object: 000000ADA7CFDE50
 1: 00007FF7314F058F napi_wrap+109311
 2: 00007FF731424D8F std::basic_ostream<char,std::char_traits<char> >::operator<<+57151
 3: 00007FF73205E412 V8_Fatal+162
 4: 00007FF731B022AD v8::internal::BackingStore::Reallocate+653
 5: 00007FF731D480E9 v8::ArrayBuffer::GetBackingStore+137
 6: 00007FF7314D2469 napi_get_typedarray_info+393
 7: 00007FF9FDD89B41
 8: 00007FF9FDD8F28D
 9: 00007FF9FDD87EC3
10: 00007FF9FDD8EAE3
11: 00007FF7314CCD86 node::Stop+35046
12: 00007FF731D0E72F v8::internal::Builtins::builtin_handle+321471
13: 00007FF731D0DCC4 v8::internal::Builtins::builtin_handle+318804
14: 00007FF731D0DFB7 v8::internal::Builtins::builtin_handle+319559
15: 00007FF731D0DE03 v8::internal::Builtins::builtin_handle+319123
16: 00007FF731DE9F9D v8::internal::SetupIsolateDelegate::SetupHeap+464173
17: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
18: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
19: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
20: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
21: 00007FF731DBB475 v8::internal::SetupIsolateDelegate::SetupHeap+272901
22: 00007FF731E5FEFE v8::internal::SetupIsolateDelegate::SetupHeap+947342
23: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
24: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
25: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
26: 00007FF731D7E661 v8::internal::SetupIsolateDelegate::SetupHeap+23537
27: 00007FF731E68343 v8::internal::SetupIsolateDelegate::SetupHeap+981203
28: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
29: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
30: 00007FF731D7E661 v8::internal::SetupIsolateDelegate::SetupHeap+23537
31: 00007FF731E68343 v8::internal::SetupIsolateDelegate::SetupHeap+981203
32: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
33: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
34: 00007FF731DFC0BE v8::internal::SetupIsolateDelegate::SetupHeap+538190
35: 00007FF731D828A2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
36: 00007FF731D8055E v8::internal::SetupIsolateDelegate::SetupHeap+31470
37: 00007FF731D8014C v8::internal::SetupIsolateDelegate::SetupHeap+30428
38: 00007FF731C50631 v8::internal::Execution::CallWasm+1649
39: 00007FF731C4FE9F v8::internal::Execution::Call+191
40: 00007FF731D3B7E7 v8::Function::Call+615
41: 00007FF7315145FB node::CallbackScope::~CallbackScope+1659
42: 00007FF731514A61 node::MakeCallback+209
43: 00007FF731514BF8 node::MakeCallback+312
44: 00007FF73151496B node::MakeCallback+139
45: 00007FF9ECA47FDD rclnodejs::ShadowNode::Execute+557 [P:\ros2webbridge\ros2-web-bridge\node_modules\rclnodejs\src\shadow_node.cpp]:L123
46: 00007FF9ECA1D59E rclnodejs::Executor::ExecuteReadyHandles+158 [P:\ros2webbridge\ros2-web-bridge\node_modules\rclnodejs\src\executor.cpp]:L258
47: 00007FF73154484B uv_async_send+331
48: 00007FF731543FDC uv_loop_init+1292
49: 00007FF73154417A uv_run+202
50: 00007FF7314502B5 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NumberOfBucketsOffset+9365
51: 00007FF7314C3A17 node::Start+311
52: 00007FF73132686C RC4_options+339820
53: 00007FF7322C604C v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+153532
54: 00007FFA5C1E7C24 BaseThreadInitThunk+20
55: 00007FFA5CF8D4D1 RtlUserThreadStart+33

My unity code is looks like this:

public class ExampleAction : MonoBehaviour
{
    private RosConnector rosConnector;

    private void Start()
    {
        rosConnector = GetComponent<RosConnector>();

        new Thread(Subscribe).Start();
        new Thread(Subscribe2).Start();

        Debug.Log("Start called");
    }

    private void Subscribe()
    {
        if (!rosConnector.IsConnected.WaitOne(10 * 1000))
            Debug.LogWarning("Failed to subscribe: RosConnector not connected");

        rosConnector.RosSocket.Subscribe<RosSharp.RosBridgeClient.MessageTypes.Std.String>("/topic", SubscriptionHandler, 0); // the rate(in ms in between messages) at which to throttle the topics
    }

    private void Subscribe2()
    {
        if (!rosConnector.IsConnected.WaitOne(10 * 1000))
            Debug.LogWarning("Failed to subscribe: RosConnector not connected");

        rosConnector.RosSocket.Subscribe<RosSharp.RosBridgeClient.MessageTypes.Std.String>("/topic2", SubscriptionHandler, 0); // the rate(in ms in between messages) at which to throttle the topics
    }

    private static void SubscriptionHandler(std_msgs.String message)
    {
        Debug.Log((message).data);
    }
}

The topics are being published at 100Hz by a simple python script using rclpy, though I was originally trying to replay a bag file sending topics at a similar rate with the same results.

I've tried downgrading Node.js to version 12.9.0. It lasts much longer using this version (5-10 minutes) but eventually closes with no error.

I'm very new to Ros/Ros2 so I'm not sure how to test the Ros2webbridge independent of Ros# though the issue only ever happens after the application has subscribed to the topics.

The more topics I subscribe to the faster it seems to crash as well.

@MartinBischoff
Copy link
Collaborator

Hi @slogan-oxts ,
did you check issue #315 and apply the ROS2-related fixes mentioned there?
Maybe the contributors of that issue can help you further?

@slogan-oxts
Copy link
Author

Hi @MartinBischoff

Yes I did try the resolution in that ticket but it seemed to make no difference.

I've managed to get a test using only ros2webbridge working and it seems to fail with the same issue so it looks like the issue is probably in there. I'll close this one for now and make a ticket on that repository.

@MartinBischoff
Copy link
Collaborator

Thanks @slogan-oxts , please feel free to reopen if you see that the problem is related to ROS#.
Can you share the link to the other issue here?

@slogan-oxts
Copy link
Author

slogan-oxts commented Jan 27, 2021

The solution to this issue was to use a different version of node.js. The latest erbium release (12.20.1 at the time of writing).

After installing this is seems to be working perfectly both inside and outside of ROS#.

More information in the ros2webbridge ticket:
http://github.com/RobotWebTools/ros2-web-bridge/issues/173

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

No branches or pull requests

2 participants