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

Fix warning about pytaken_msg maybe being uninitialized #551

Merged
merged 2 commits into from
Apr 28, 2020

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Apr 28, 2020

Seen in https://ci.ros2.org/job/nightly_linux_release/1525/gcc/new/

This initializes pytaken_msg with NULL, and changes the check that pytaken_msg is not NULL to cover both raw and non-raw cases.

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz sloretz added the bug Something isn't working label Apr 28, 2020
@sloretz sloretz self-assigned this Apr 28, 2020
@sloretz
Copy link
Contributor Author

sloretz commented Apr 28, 2020

CI (testing just rclpy)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
Copy link
Contributor Author

sloretz commented Apr 28, 2020

CI windows only shows these test failures which are clearly unrelated to this PR

    projectroot.test_timer
    rclpy.src.ros2.rclpy.rclpy.test.test_timer.test_zero_callback[0.01]
    rclpy.src.ros2.rclpy.rclpy.test.test_timer.test_number_callbacks[0.01]

But console output shows

19: ..\..\src\ros2\rclpy\rclpy\test\test_node.py ........................... [ 46%]
19: F..............................                                          [100%]
19: 
19: ================================== FAILURES ===================================
19: _________________ TestNodeAllowUndeclaredParameters.test_take _________________
19: 
19: self = <test.test_node.TestNodeAllowUndeclaredParameters testMethod=test_take>
19: 
19:     def test_take(self):
19:         basic_types_pub = self.node.create_publisher(BasicTypes, 'take_test', 1)
19:         sub = self.node.create_subscription(
19:             BasicTypes,
19:             'take_test',
19:             self.dummy_cb,
19:             1)
19:         basic_types_msg = BasicTypes()
19:         basic_types_pub.publish(basic_types_msg)
19:         cycle_count = 0
19:         while cycle_count < 5:
19:             with sub.handle as capsule:
19:                 result = _rclpy.rclpy_take(capsule, sub.msg_type, False)
19:             if result is not None:
19:                 msg, info = result
19: >               self.assertNotEqual(0, info['source_timestamp'])
19: E               TypeError: 'NoneType' object is not subscriptable
19: 
19: ..\..\src\ros2\rclpy\rclpy\test\test_node.py:157: TypeError
19: - generated xml file: C:\ci\ws\build\rclpy\test_results\rclpy\test_node.xunit.xml -
19: =========================== short test summary info ===========================
19: FAILED ..\..\src\ros2\rclpy\rclpy\test\test_node.py::TestNodeAllowUndeclaredParameters::test_take
19: ======================== 1 failed, 57 passed in 0.95s =========================
19: -- run_test.py: return code 1
19: -- run_test.py: verify result file 'C:/ci/ws/build/rclpy/test_results/rclpy/test_node.xunit.xml'
19/45 Test #19: test_node .........................***Failed    1.81 sec
test 20

Which may be related, and wasn't captured in the test results. Investigating.

@sloretz
Copy link
Contributor Author

sloretz commented Apr 28, 2020

Which may be related, and wasn't captured in the test results. Investigating.

Ok, I think I understand what happened here. The test got re-ran because CI uses --retest-until-pass 2 and the second test passed. The test is flaky and passed the second time. This comes down to rclpy_take() returning (None, None) when take fails since #550 (@hidmic FYI) which was added to fix #542 crashing in this case, but the original behavior is that the code used to return just None. This happens when the subscription wakes the wait set, but the middleware says there is no message.

Anyways, this PR is good as is. I'll open a separate PR to make rclpy_take return just None like it used to. Edit: changed my mind about how I'd like to fix this.

@sloretz sloretz merged commit 9059946 into master Apr 28, 2020
@delete-merged-branch delete-merged-branch bot deleted the pytaken_msg_maybe_uninitialized branch April 28, 2020 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants