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

[Tests] Error in Windows GUI tests "in connect connect(self.reply.readyRead, self.on_read_data)" #6582

Closed
drew2a opened this issue Nov 24, 2021 · 7 comments

Comments

@drew2a
Copy link
Contributor

drew2a commented Nov 24, 2021

During the test of #6580 the following error occurred:

Stacktrace

ERROR    ErrorHandler:error_handler.py:40 tribler_gui.utilities.CreationTraceback: 
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\tribler\AppData\Local\Programs\Python\Python38\Scripts\pytest.exe\__main__.py", line 7, in <module>
    sys.exit(console_main())
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 180, in console_main
    code = main()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 157, in main
    ret = config.hook.pytest_cmdline_main(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 289, in pytest_cmdline_main
    return wrap_session(config, _main)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 240, in wrap_session
    session.exitstatus = doit(config, session) or 0
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 296, in _main
    config.hook.pytest_runtestloop(session=session)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 321, in pytest_runtestloop
    item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 100, in pytest_runtest_protocol
    runtestprotocol(item, nextitem=nextitem)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 111, in runtestprotocol
    rep = call_and_report(item, "setup", log)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 207, in call_and_report
    call = call_runtest_hook(item, when, **kwds)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 246, in call_runtest_hook
    return CallInfo.from_call(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 294, in from_call
    result = func()  # type: Optional[_T]
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 247, in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 141, in pytest_runtest_setup
    item.session._setupstate.prepare(item)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 432, in prepare
    col.setup()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\python.py", line 1576, in setup
    self._request._fillfixtures()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 568, in _fillfixtures
    item.funcargs[argname] = self.getfixturevalue(argname)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 581, in getfixturevalue
    fixturedef = self._get_active_fixturedef(argname)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 601, in _get_active_fixturedef
    self._compute_fixture_value(fixturedef)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 683, in _compute_fixture_value
    fixturedef.execute(request=subrequest)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 1062, in execute
    result = hook.pytest_fixture_setup(fixturedef=self, request=request)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 1117, in pytest_fixture_setup
    result = call_fixture_func(fixturefunc, request, kwargs)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\site-packages\_pytest\fixtures.py", line 915, in call_fixture_func
    fixture_result = next(generator)
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\tests\test_gui.py", line 51, in window
    wait_for_signal(
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\tests\test_gui.py", line 86, in wait_for_signal
    QTest.qWait(100)
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\event_request_manager.py", line 137, in connect
    connect(self.reply.readyRead, self.on_read_data)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\utilities.py", line 373, in trackback_wrapper
    raise exc from CreationTraceback(traceback_str)
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\utilities.py", line 370, in trackback_wrapper
    callback(*args, **kwargs)
  File "E:\jenkins\workspace\GH_Tribler_PR_Tests\PR_GUI_win64@2\tribler\src\tribler-gui\tribler_gui\event_request_manager.py", line 104, in on_read_data
    json_dict = json.loads(event)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 33 (char 32)

Full log

https://jenkins-ci.tribler.org/job/GH_Tribler_PR_Tests/job/PR_GUI_win64/3589/console

@ichorid
Copy link
Contributor

ichorid commented Nov 24, 2021

Again, this is due to half-done refactoring of the startup process. Let's merge #6573 first.

@drew2a
Copy link
Contributor Author

drew2a commented Nov 25, 2021

Still reproduced in #6588 even after #6573 had been merged.

See https://jenkins-ci.tribler.org/job/GH_Tribler_PR_Tests/job/PR_GUI_win64/3613/console

@ichorid
Copy link
Contributor

ichorid commented Nov 25, 2021

WARNING  root:utilities.py:387 Unable to hook up connect() info to <built-in method emit of PyQt5.QtCore.pyqtBoundSignal object at 0x0000000008767570>. Probably a 'builtin_function_or_method'.
WARNING  root:utilities.py:387 Unable to hook up connect() info to <built-in method update of QGraphicsSvgItem object at 0x0000000029291670>. Probably a 'builtin_function_or_method'.
WARNING  root:utilities.py:387 Unable to hook up connect() info to <built-in method update of QGraphicsSvgItem object at 0x0000000029291CA0>. Probably a 'builtin_function_or_method'.

Looks like our connect utility can't connect on Windows, not just Mac.

BTW, this should be affecting the release branch too!

@qstokkink
Copy link
Contributor

qstokkink commented Nov 26, 2021

@ichorid the connect() not being able to hook up a signal creates a signal that can't be disconnected (not good!). However, even if the wrapper can't be disconnected, it will still be hooked in (line 392):

else:
logging.warning(
"Unable to hook up connect() info to %s. Probably a 'builtin_function_or_method'.", repr(callback)
)
# Step 3: Connect our wrapper to the signal.
signal.connect(trackback_wrapper)

json.decoder.JSONDecodeError: Extra data is what you get when you feed json.loads multiple objects. For example:

json.loads('"" ""')
json.loads('[] []')
json.loads('{} {}')
json.loads('[] {}')

Probably either something is sending multiple JSON objects or the EventRequestManager may be splitting event strings wrong because there are double newlines contained in the forwarded JSON.

Hope that helps shorten the bug hunt 👍

@ichorid
Copy link
Contributor

ichorid commented Nov 26, 2021

Related to #2335

@qstokkink

This comment has been minimized.

@drew2a
Copy link
Contributor Author

drew2a commented Nov 30, 2021

@qstokkink yes you are right, I made a mistake with the linking. The correct issue is #6583

I've removed my comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants