Skip to content

Commit 40f7fc5

Browse files
committed
Log failed attempts at closing the failed thrift connections
1 parent 76995a6 commit 40f7fc5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

elasticsearch/connection/thrift.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import absolute_import
22
from socket import timeout as SocketTimeout
33
import time
4+
import logging
45

56
try:
67
from .esthrift import Rest
@@ -16,6 +17,8 @@
1617
from ..exceptions import ConnectionError, ImproperlyConfigured
1718
from .pooling import PoolingConnection
1819

20+
logger = logging.getLogger('elasticsearch')
21+
1922
class ThriftConnection(PoolingConnection):
2023
"""
2124
Connection using the `thrift` protocol to communicate with elasticsearch.
@@ -69,8 +72,11 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
6972
try:
7073
# try closing transport socket
7174
tclient.transport.close()
72-
except:
73-
pass
75+
except Exception as e:
76+
logger.warning(
77+
'Exception %s occured when closing a failed thrift connection.',
78+
e, exc_info=True
79+
)
7480
raise ConnectionError('N/A', str(e), e)
7581

7682
self._release_connection(tclient)

0 commit comments

Comments
 (0)