Skip to content

Commit 0e89178

Browse files
committed
Python API: fix missing close() after timeout in EC writer
1 parent 5c21c22 commit 0e89178

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

oio/api/ec.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99
# This library is distributed in the hope that it will be useful,
1010
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1212
# Lesser General Public License for more details.
1313
#
1414
# You should have received a copy of the GNU Lesser General Public
@@ -798,11 +798,13 @@ def _send(self):
798798
eventlet_yield()
799799
except (Exception, SocketError, ChunkWriteTimeout) as exc:
800800
self.failed = True
801-
msg = str(exc)
801+
# With SocketError the timeout value is not printed automatically.
802+
msg = f"{exc}, read_timeout={self.read_timeout}"
802803
self.logger.warning(
803804
"Failed to write to %s (%s, reqid=%s)", self.chunk, msg, self.reqid
804805
)
805806
self.chunk["error"] = f"write: {msg}"
807+
io.close_source(self, self.logger)
806808
# Indicate that the data is completely sent
807809
self.queue.task_done()
808810

0 commit comments

Comments
 (0)