mssql_script module - Segmentation fault error

I’m running the bellow play

  • name: Setup url

run_once: true

community.general.mssql_script:

login_user: “{{ mssql_login_user }}”

login_password: “{{ mssql_login_password }}”

login_host: “{{ mssql_host }}”

login_port: “{{ mssql_port }}”

db: MSSQLDB

script: “SELECT 1”

register: result_params

on remote host - Python 3.6.8 , pymssql-2.2.7

I get the error bellow

fatal: [hostname]: FAILED! => {

“ansible_facts”: {

“discovered_interpreter_python”: “/usr/libexec/platform-python”

},

“changed”: false,

“module_stderr”: “Shared connection to hostname closed.\r\n”,

“module_stdout”: “/bin/sh: line 1: 3580297 Segmentation fault (core dumped) /usr/libexec/platform-python /home/svc/.ansible/tmp/ansible-tmp-1684217329.507804-55251-184388487997846/AnsiballZ_mssql_script.py\r\n”,

“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,

“rc”: 139

}

The error message you provided indicates a segmentation fault in the execution of the Ansible module mssql_script on the remote host. A segmentation fault typically occurs when a program attempts to access memory that it is not allowed to access, leading to a crash.

There could be multiple reasons for this error, including compatibility issues, incorrect installation, or system-specific configurations. Here are a few suggestions to troubleshoot and resolve the issue:

Check compatibility: Ensure that the version of pymssql (2.2.7) you installed is compatible with the version of Python (3.6.8) on the remote host. Verify if there are any specific compatibility requirements mentioned in the pymssql documentation.

Verify installation: Double-check that pymssql is correctly installed on the remote host. You can try importing pymssql in a Python interactive session on the remote host to verify if it can be imported without any errors.

Review system-specific configurations: Some systems might require additional configurations or dependencies for pymssql to function properly. Ensure that all the necessary dependencies are installed on the remote host. Check if there are any specific system requirements mentioned in the pymssql documentation.

Update pymssql and dependencies: If possible, try updating pymssql to the latest version. It could include bug fixes or improvements that address the issue you are facing. Additionally, make sure all the required dependencies (such as FreeTDS) are up to date.

Enable verbose output: Modify your Ansible playbook to enable verbose output by adding the -vvv option. This can provide more detailed information about the error and help pinpoint the cause.

Review system logs: Check the system logs on the remote host for any relevant error messages or additional information related to the segmentation fault. The logs may provide clues about the underlying cause.