question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wait_for_connection gives errors

See original GitHub issue

I’m using ansible + mitogen for automated server updates on Ubuntu. I’m using these tasks to check if a reboot is necessary after the apt upgrade task:

  - name: Check if reboot is required
    stat:
      path: /var/run/reboot-required
    register: reboot_required

  - name: Reboot server
    shell: sleep 2 && shutdown -r now "Ansible updates triggered"
    async: 1
    poll: 0
    when: reboot_required.stat.exists == True

  - name: Wait 300 seconds for server to become available
    wait_for_connection:
      delay: 30
      timeout: 300
    when: reboot_required.stat.exists == True

This can be manually reproduced by just creating a /var/run/reboot-required file.

I recently updated to the latest ansible (2.8.5) and mitogen (master branch). Previously the wait_for_connection would trigger a warning ([WARNING]: Reset is not implemented for this connection), but now the following error is shown every second, from the moment the reboot is complete:

ERROR! [mux  23628] 12:00:35.305036 E mitogen.service: Pool(1c50, size=32, th='mitogen.Pool.1c50.24'): while invoking u'reset' of u'ansible_mitogen.services.ContextService'
Traceback (most recent call last):
  File "/home/epartment/epaflex/mitogen-master/mitogen/service.py", line 621, in _on_service_call
    return invoker.invoke(method_name, kwargs, msg)
  File "/home/epartment/epaflex/mitogen-master/mitogen/service.py", line 307, in invoke
    response = self._invoke(method_name, kwargs, msg)
  File "/home/epartment/epaflex/mitogen-master/mitogen/service.py", line 293, in _invoke
    ret = method(**kwargs)
  File "/home/epartment/epaflex/mitogen-master/ansible_mitogen/services.py", line 186, in reset
    mitogen.core.listen(context, 'disconnect', l.put)
  File "/home/epartment/epaflex/mitogen-master/mitogen/core.py", line 431, in listen
    _signals(obj, name).append(func)
  File "/home/epartment/epaflex/mitogen-master/mitogen/core.py", line 421, in _signals
    obj.__dict__
AttributeError: 'NoneType' object has no attribute '__dict__'

When disabling mitogen, the playbook runs fine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:7

github_iconTop GitHub Comments

3reactions
davidklafteneggercommented, Dec 24, 2019

I can reproduce the issue with any use of wait_for_connection

As a workaround you can specify strategy: linear in plays that use this particular module, but to still benefit from mitogen it might be necessary to split this one task out into a separate play within the playbook.

1reaction
s1113950commented, Apr 30, 2020

I integrated the test scenario mentioned in the ticket description into #710 (had to use docker though because testing shutdown is a bit hard on a localhost machine 😅 ). Once all tests pass/PR is approved I’ll merge and this issue should be fixed 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Message: Waitforconnectfailed - TeamViewer Community
I updated the installation and it works right after that, but then goes back to the waitforconnect failed. if I reboot the machine...
Read more >
NamedPipeServerStream.BeginWaitForConnection fails with ...
It appears that Client closes the connection before it is completely handled by Server. It happens because clientStream.
Read more >
NamedPipeServerStream.WaitForConnection Method
The pipe connection has been broken. Examples. The following example demonstrates a method to send a string from a parent process to a...
Read more >
Support async NamedPipeServerStream.WaitForConnection ...
Motivating use case: My codebase is using synchronous pipe IO for IPC. The application spends a lot of CPU in the IPC mechanism, ......
Read more >
840D error 120202 wait for connection to nc/plc - 62589
i have problem 840D error 120202 wait for connection to nc/plc in my m/c ... i did try but when i go to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found