New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mosquitto_reconnect seems memory leak when TLS error #592
Comments
Could you show any evidence of the memory leak except for reviewing code? |
We use TLS and mosquitto. The procedure is as follows.
|
I'm not familiar with libmosquitto, so I cannot reproduce your situation. |
I've not been able to reproduce your problem. I've used the partial bit of code you provided. Can you provide any more details? |
This is definitely still a problem in 1.5.3
There is a check in
If I remove the check and always close the socket, then the leaks go away. |
Thanks for the hint, I believe this is now fixed. Are you able to check the |
Version 1.5.4. * Fixes memory leak, GitHub eclipse#592 * Fixes TLS reconnects, GitHub eclipse#990 MAINE-140, MAINE-361
I found it seems like memory leak when mosquitto_reconnect was used if TLS error. Plz reffer net_mosq.c line 880-901, version 1.4.14
while(packet->to_process > 0){
write_length = _mosquitto_net_write(mosq, &(packet->payload[packet->pos]), packet->to_process);
if(write_length > 0){
#if defined(WITH_BROKER) && defined(WITH_SYS_TREE)
g_bytes_sent += write_length;
#endif
packet->to_process -= write_length;
packet->pos += write_length;
}else{
#ifdef WIN32
errno = WSAGetLastError();
#endif
if(errno == EAGAIN || errno == COMPAT_EWOULDBLOCK){
pthread_mutex_unlock(&mosq->current_out_packet_mutex);
return MOSQ_ERR_SUCCESS; //The packet is not free here
}else{
pthread_mutex_unlock(&mosq->current_out_packet_mutex);
switch(errno){
case COMPAT_ECONNRESET:
return MOSQ_ERR_CONN_LOST; //The packet is not free here
default:
return MOSQ_ERR_ERRNO; //The packet is not free here
}
}
}
}
The text was updated successfully, but these errors were encountered: