Skip to content

Async tests sometimes randomly cause errors #137

@dgelessus

Description

@dgelessus

The async tests (tests/test_async.py) sometimes cause errors for no apparent reason. For example, this error message appears every now and then for me locally and on Travis:

test_call_at (tests.test_async.AsyncCallTests) ... Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File ".../rubicon-objc/rubicon/objc/eventloop.py", line 197, in _cf_socket_callback
    callback, args = self._writer
TypeError: 'NoneType' object is not iterable

This is an exception that was raised from inside a ctypes callback function, which means that it cannot propagate normally. When this happens, ctypes prints out the exception, but it does not terminate Python like uncaught exceptions normally do, and the test in question does not count as failed. Because of this, the error has been more or less ignored so far (or perhaps not even noticed when it appeared).

Another error that I've just come across is this:

FAIL: test_run_forever (tests.test_async.AsyncRunTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/travis/build/beeware/rubicon-objc/tests/test_async.py", line 56, in test_run_forever
    self.assertEqual(results2, [0, 1, 2, 3])
AssertionError: Lists differ: [0, 1, 2] != [0, 1, 2, 3]
Second list contains 1 additional elements.
First extra element 3:
3
- [0, 1, 2]
+ [0, 1, 2, 3]
?         +++

Unlike the first error, this is an actual test failure.

I'm really not familiar with the async-related parts of Rubicon, so I don't know what could be going wrong here. I'm not sure if these two errors are even related, but I'm reporting them together, because they are both related to some sort of timing problem or race condition that is not noticeable very often.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA crash or error in behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions