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

Segmentation fault when using requests/pynetbox with pyATS on Apple Silicon macOS #252

Open
geortich opened this issue Nov 17, 2024 · 0 comments

Comments

@geortich
Copy link

geortich commented Nov 17, 2024

Description

When using the requests library (directly or via pynetbox) with pyATS on macOS with Apple Silicon, the process crashes with a segmentation fault during fork pre-exec. The same code works perfectly when run in a Linux environment (Docker).

Environment

  • OS: macOS Sonoma 14.4.1 (tested on both M1 and M2 architectures)
  • Python: 3.11 and 3.12
  • pyATS: 24.7, 24.9, and 24.10 (issue present in all versions)
  • requests: 2.31.0 and 2.32.3 (issue present in both versions)
  • Architecture: Apple Silicon (M1 and M2)
  • HTTP or HTTPS API calls

Steps to Reproduce

  1. Create a simple test using requests within pyATS:
from pyats import aetest
import logging
import requests

logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

class TestRequests(aetest.Testcase):
    @aetest.setup
    def setup(self):
        self.url = "http://jsonplaceholder.typicode.com/posts/1"

    @aetest.test
    def test_simple_request(self):
        response = requests.get(self.url)
        logger.info(f"Response status code: {response.status_code}")
  1. Run with easypy:
from pyats.easypy import run

def main():
    run(
        testscript="test.py",
        taskid="Simple_Request_Test"
    )

Error output

Python crashes with a cryptic error, Stopping Context.
However, mac OS produces a crash report with the following details

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000110
Exception Codes:       0x0000000000000001, 0x0000000000000110
Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [PROCESS_ID]
Application Specific Information:
*** multi-threaded process forked ***
crashed on child side of fork pre-exec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant