Skip to content

SOCK_STREAM Error #2

@Bobspadger

Description

@Bobspadger

Occasionally when trying to initiate an API call / or the API (not sure which at present) I get the following:

Traceback (most recent call last):
  File "sales_note_add.py", line 109, in <module>
    main()
  File "sales_note_add.py", line 87, in main
    orderStatus = get_order(orderId)
  File "sales_note_add.py", line 56, in get_order
    order = mage.sales_order.info(order_id)
  File "/Users/mmuser/Documents/magento19-api/magento/__init__.py", line 142, in call_method
    return self._client.call(self._session_id, path, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1240, in __call__
    return self.__send(self.__name, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1599, in __request
    verbose=self.__verbose
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1280, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1308, in single_request
    self.send_content(h, request_body)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1456, in send_content
    connection.endheaders(request_body)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1266, in connect
    HTTPConnection.connect(self)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 832, in connect
    self.timeout, self.source_address)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

I believe this is where our web server has an issue processing the request and throws an error.

It would be good to build into the magento code some form of error handling for broken connections / calls so they are always handled with a retry(?) so its all rolled up in the API call rather than writing it into the functions calling the API (one place for the connection and error handling)

I will try to fix this in the near future but if anyone has noticed this issue and fixed it already then superb!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions