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

Error when running mitogen: "struct.error: 'q' format requires -9223372036854775808 <= number <= 9223372036854775807" #1205

Open
afonso360 opened this issue Dec 23, 2024 · 2 comments
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome

Comments

@afonso360
Copy link

afonso360 commented Dec 23, 2024

👋 Hey,

I was experimenting with mitogen today, and ran into the following issues in one of our devices:

ERROR! [mux  38874] 12:56:57.828568 E mitogen.[ssh.lisbon-wago-pfc200.netbird.cloud]: ExternalContext.main() crashed
Traceback (most recent call last):
  File "<stdin>", line 4184, in main
  File "<stdin>", line 3921, in run
  File "<stdin>", line 675, in _profile_hook
  File "<stdin>", line 3904, in _dispatch_calls
  File "<stdin>", line 1233, in __iter__
  File "<stdin>", line 1219, in get
  File "<stdin>", line 2831, in get
  File "<stdin>", line 2795, in _make_cookie
struct.error: 'q' format requires -9223372036854775808 <= number <= 9223372036854775807

This happens when gathering facts on a normal playbook. I've tested this playbook with mitogen on different hosts and it ran normally.

  • Do you have some idea of what the underlying problem may be?

I suspect it's something to do with this being a musl linked python interpreter, but I can't really confirm it. I've attached strace logs (following the instructions on the website) as well as ansible logs with the verbose flags.

The logs are running on the latest git commit of mitogen (e8005ec) and the error seems to point to this line (

mitogen/mitogen/core.py

Lines 2795 to 2796 in e8005ec

return struct.pack(self.COOKIE_FMT, self.COOKIE_MAGIC,
os.getpid(), id(self), thread.get_ident())
)

I haven't run into any incompatibilities when running ansible (without mitogen) on this host otherwise.

  • Which version of Ansible are you running?
ansible [core 2.17.6]
  • Is your version of Ansible patched in any way?

It's installed from homebrew but I don't think they carry any patches

  • Are you running with any custom modules, or module_utils loaded?

No

  • Have you tried the latest master version from Git?

Yes!

  • Mention your host and target OS and versions

Host: MacOS Sonoma 14.6.1
Target: PTXDist 4.6.1 (Linux bad 5.15.107-rt62-w04.03.06 #1 PREEMPT_RT Wed Oct 23 17:06:52 UTC 2024 armv7l GNU/Linux)

  • Mention your host and target Python versions

Host Python: Python 3.12.7 (Installed from homebrew)
Target Python: Python 3.13.1 (Built against musl libc)

Attached Files:

ansible-verbose.txt
ansible-config-changed.txt
strace-python.12959.12963.txt
strace-python.12959.12964.txt
strace-python.12959.12986.txt

@afonso360 afonso360 added affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome labels Dec 23, 2024
@afonso360
Copy link
Author

It looks like thread.get_ident() on this device returns a huge number...

root@bad:~ python3
Python 3.13.1 (main, Dec 10 2024, 03:04:53) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _thread as thread
>>> thread.get_ident()
18446744072484806452

@afonso360
Copy link
Author

afonso360 commented Dec 24, 2024

This may also be Python 3.13 / 3.13.1 specific. I installed Python 3.12.8 and I now get reasonable numbers out of get_ident

root@bad:~ python3
Python 3.12.8 (main, Dec  7 2024, 05:56:13) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _thread as thread
>>> thread.get_ident()
3069599540

With this version of Python mitogen now runs without any issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-0.3 Issues related to 0.3.X Mitogen releases bug Code feature that hinders desired execution outcome
Projects
None yet
Development

No branches or pull requests

1 participant