Fix memory-leak on the failure of px_finish_trans

This commit is contained in:
obdev 2023-04-23 10:41:06 +00:00 committed by ob-robot
parent 32340853ab
commit f5d814801f
2 changed files with 11 additions and 10 deletions

View File

@ -49,9 +49,9 @@ static int easy_encode_uint64(char *buf, const uint64_t buf_len, int64_t *pos, u
if (EASY_OK == ret) {
*(buf + (*pos)++) = (char)(((val) >> 56) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 48) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 40) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 32) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 24) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 40) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 32) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 24) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 16) & 0xff);
*(buf + (*pos)++) = (char)(((val) >> 8) & 0xff);
*(buf + (*pos)++) = (char)((val) & 0xff);
@ -179,9 +179,9 @@ PACKET HEADER:
+------------------------------------------------------------------------+
PACKET MSG BODY:
+------------------------------------------------------------------------+
| io thread corresponding eio magic(8B) | io thread index (1B)
+------------------------------------------------------------------------+
+------------------------------------------------------------------------+
| io thread corresponding eio magic(8B) | io thread index (1B)
+------------------------------------------------------------------------+
*/
int net_send_negotiate_message(uint8_t negotiation_enable, int fd, uint64_t magic, int8_t index, uint32_t *conn_has_error)
@ -261,9 +261,9 @@ void net_consume_negotiation_msg(int fd, uint64_t magic)
return;
}
if (ne_msg.msg_header.header_magic == EASY_NEGOTIATION_PACKET_HEADER_MAGIC &&
(ne_msg.msg_body.eio_magic == magic || easy_magic_in_support_list(ne_msg.msg_body.eio_magic))) {
while ((rcv_bytes = recv(fd, (char *) recv_buf, decode_len, 0)) < 0 && errno == EINTR);
if (ne_msg.msg_header.header_magic == EASY_NEGOTIATION_PACKET_HEADER_MAGIC &&
(ne_msg.msg_body.eio_magic == magic || easy_magic_in_support_list(ne_msg.msg_body.eio_magic))) {
while ((rcv_bytes = recv(fd, (char *) recv_buf, decode_len, 0)) < 0 && errno == EINTR);
if (rcv_bytes <= 0) {
easy_error_log("consume negotiaion buffer failed! fd:%d, errno:%d", fd, errno);
} else {

View File

@ -158,7 +158,8 @@ int ObTableDirectInsertService::close_task(const uint64_t table_id,
if (OB_FAIL(store.px_finish_trans(trans_id))) {
LOG_WARN("fail to finish direct load trans", KR(ret), K(trans_id));
}
} else {
}
if (OB_FAIL(ret)){
if (OB_FAIL(store.px_abandon_trans(trans_id))) {
LOG_WARN("fail to abandon direct load trans", KR(ret));
}