Oipo commented on a change in pull request #245:
URL: https://github.com/apache/celix/pull/245#discussion_r436572520



##########
File path: bundles/pubsub/pubsub_admin_tcp/src/pubsub_tcp_handler.c
##########
@@ -1266,9 +1269,12 @@ void pubsub_tcpHandler_handler(pubsub_tcpHandler_t 
*handle) {
         }
         pubsub_tcpHandler_close(handle, events[i].ident);
       } else if (events[i].flags & EV_ERROR) {
+        celixThreadRwlock_unlock(&handle->dbLock);
         L_ERROR("[TCP Socket]:EPOLLERR  ERROR read from socket %s\n", 
strerror(errno));
         pubsub_tcpHandler_close(handle, events[i].ident);
         continue;
+      } else {
+        celixThreadRwlock_unlock(&handle->dbLock);

Review comment:
       The problem solved here is that pubsub_tcpHandler_close also locks a 
mutex and can cause potential deadlocks because of different ordering (I forgot 
where the other order happened)
   
   So since there is no use in locking the dbLock while calling 
pubsub_tcpHandler_close, we unlock it before that happens. Hence the unlock is 
done in every branch. It's either that, or introduce a boolean variable to 
check if it has already been unlocked.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to