[sr-dev] [kamailio/kamailio] htable race condition on expired keys (#1152)

lazedo notifications at github.com
Mon Jun 19 14:14:30 CEST 2017


sorry about that, patch updated

```
diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c
index 1bbd079..b5872d0 100644
--- a/src/modules/htable/ht_api.c
+++ b/src/modules/htable/ht_api.c
@@ -674,6 +674,7 @@
 				&& strncmp(name->s, it->name.s, name->len)==0)
 		{
 			/* found */
+#if 0
 			if(now>0 && it->expire!=0 && it->expire<now) {
 				/* entry has expired */
 				ht_handle_expired_record(ht, it);
@@ -697,6 +698,7 @@
 					return NULL;
 				}
 			}
+#endif
 			/* update value */
 			if(it->flags&AVP_VAL_STR)
 			{
@@ -803,6 +805,7 @@
 				&& strncmp(name->s, it->name.s, name->len)==0)
 		{
 			/* found */
+#if 0
 			if(ht->htexpire>0 && it->expire!=0 && it->expire<time(NULL)) {
 				/* entry has expired, delete it and return NULL */
 				ht_handle_expired_record(ht, it);
@@ -818,6 +821,7 @@
 				ht_cell_free(it);
 				return NULL;
 			}
+#endif
 			if(old!=NULL)
 			{
 				if(old->msize>=it->msize)
@@ -1056,7 +1060,6 @@
 					if(it->expire!=0 && it->expire<now)
 					{
 						/* expired */
-						ht_handle_expired_record(ht, it);
 						if(it->prev==NULL)
 							ht->entries[i].first = it->next;
 						else
@@ -1064,6 +1067,7 @@
 						if(it->next)
 							it->next->prev = it->prev;
 						ht->entries[i].esize--;
+						ht_handle_expired_record(ht, it);
 						ht_cell_free(it);
 					}
 					it = it0;
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1152#issuecomment-309422043
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20170619/7880eb0f/attachment-0001.html>


More information about the sr-dev mailing list