1

I have an ansible playbook what configures 3 completely identical server setups. No manual changes done after the provisioning.

On one of the three servers compose a segmentation fault every second or third run. I really don't get this error.

This is not task specific. It can occur on every task in this playbook.

Does someone have an idea?

Remote Python version: 3.8.5 Ansible version: 2.10.3

Fatal Python error: Segmentation fault
 
Current thread 0x00007efcfe1b7740 (most recent call first):
  File "<frozen importlib._bootstrap>", line 682 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "/tmp/ansible_ansible.legacy.file_payload_pa4y1cn7/ansible_ansible.legacy.file_payload.zip/ansible/module_utils/basic.py", line 44 in <module>
  File "<frozen zipimport>", line 259 in load_module
  File "<frozen importlib._bootstrap>", line 618 in _load_backward_compatible
  File "<frozen importlib._bootstrap>", line 655 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 975 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 991 in _find_and_load
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1042 in _handle_fromlist
  File "/home/ansible/.ansible/tmp/ansible-tmp-1621606671.3414664-35617-104716823383080/AnsiballZ_file.py", line 37 in invoke_module
  File "/home/ansible/.ansible/tmp/ansible-tmp-1621606671.3414664-35617-104716823383080/AnsiballZ_file.py", line 94 in _ansiballz_main
  File "/home/ansible/.ansible/tmp/ansible-tmp-1621606671.3414664-35617-104716823383080/AnsiballZ_file.py", line 102 in <module>
Segmentation fault (core dumped)
Brad Solomon
  • 38,521
  • 31
  • 149
  • 235
Nortol
  • 399
  • 3
  • 9
  • 1
    This might help https://stackoverflow.com/questions/10035541/what-causes-a-python-segmentation-fault – Mithilesh_Kunal May 21 '21 at 15:09
  • You could first try upgrading to Ansible 2.10.7, though not sure if that has a related bugfix. https://github.com/ansible-community/ansible-build-data/blob/main/2.10/CHANGELOG-v2.10.rst – Brad Solomon May 21 '21 at 15:50
  • 1
    I replaced the memory and mainboard and now it is working find. I think this was a hardware issue. – Nortol Jun 24 '21 at 12:25
  • I ended in replacing the CPU. It was a hardware defect... Never heard of a CPU defect that had this symptoms. Good to know. – Nortol Aug 15 '21 at 05:47

1 Answers1

2

I also had the problem of getting a segmentation fault message when I tried to install Python packages via Ansible using the pip module.

FAILED! => {
  "changed": false, 
  "module_stderr": "Shared connection to 192.168.1.81 closed.\r\n", 
  "module_stdout": "Segmentation fault\r\n", 
  "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
  "rc": 139
}

So I did some research and reading about the problem.

Note on the solution

In one place I found a trivial comment, but it led me to the solution of my problem:

When you get a segmentation fault, it means that the computer is trying to access restricted area in memory.

I ruled out the possibility that the pip module in Python3 is intentionally accessing a wrong memory area, and I quickly came to the conclusion that the hardware was defective. So I booted the PC from a live image with memtest86+, which is also integrated in many images of Linux distributions. There I could see a large number of errors after a short time.

My solution

One of my RAM modules was faulty, so it was a hardware defect.

After replacing the RAM, the problem was solved.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
phanaz
  • 1,188
  • 8
  • 17