Error Description
When attempting to export a Span batch using the OpenTelemetry SDK, a connection error occurs. The error is manifested as ConnectionResetError: [Errno 104] Connection reset by peer
, indicating that the connection was reset by the remote server. This issue occurs when using Crew AI but not when using Langchain.
Logs
2025-04-11 - - INFO - Class: GeneralKnowledge Function: crew Message: Crew successfully created.
ERROR:opentelemetry.sdk.trace.export:Exception while exporting Span batch.
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 716, in urlopen
httplib_response = self._make_request(
File "urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "urllib3/connectionpool.py", line 1061, in _validate_conn
conn.connect()
File "urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
File "urllib3/util/ssl_.py", line 458, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "urllib3/util/ssl_.py", line 502, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
File "ssl.py", line 1042, in _create
self.do_handshake()
File "ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "requests/adapters.py", line 667, in send
resp = conn.urlopen(
File "urllib3/connectionpool.py", line 802, in urlopen
retries = retries.increment(
File "urllib3/util/retry.py", line 552, in increment
raise six.reraise(type(error), error, _stacktrace)
File "six.py", line 769, in reraise
raise value.with_traceback(tb)
File "urllib3/connectionpool.py", line 716, in urlopen
httplib_response = self._make_request(
File "urllib3/connectionpool.py", line 404, in _make_request
self._validate_conn(conn)
File "urllib3/connectionpool.py", line 1061, in _validate_conn
conn.connect()
File "urllib3/connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
File "urllib3/util/ssl_.py", line 458, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "urllib3/util/ssl_.py", line 502, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
File "ssl.py", line 1042, in _create
self.do_handshake()
File "ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "opentelemetry/sdk/trace/export/__init__.py", line 362, in _export_batch
self.span_exporter.export(self.spans_list[:idx]) # type: ignore
File "opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 189, in export
return self._export_serialized_spans(serialized_data)
File "opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 159, in _export_serialized_spans
resp = self._export(serialized_data)
File "opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 133, in _export
return self._session.post(
File "requests/sessions.py", line 637, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "requests/adapters.py", line 682, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')
Attempted Solutions
- I have tried running the LLM model on both GCP and Azure Open AI, but the same issue persists.
- This problem occurs only when using Crew AI and not when using Langchain.
- I am working on the Cloud 9 platform.
Possible Causes and Solutions
- Connection Issue: The
Connection reset by peer
error suggests that the remote server reset the connection. This could be due to network issues or server configuration problems. - SSL/TLS Configuration: Ensure that SSL/TLS certificates and configurations are correctly set up on both the server and client sides.
- Retries and Timeouts: Try increasing the number of connection retries and setting longer timeouts in the connection configuration.
If you need further assistance or have additional questions, feel free to ask!