The Samba-Bugzilla – Attachment 15023 Details for
Bug 13865
memcache grows larger then allowed maximum size
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Nasty debug patch for investigating the problem :-).
look (text/plain), 3.81 KB, created by
Jeremy Allison
on 2019-03-31 03:24:51 UTC
(
hide
)
Description:
Nasty debug patch for investigating the problem :-).
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2019-03-31 03:24:51 UTC
Size:
3.81 KB
patch
obsolete
>diff --git a/lib/util/memcache.c b/lib/util/memcache.c >index 2066fc5b2dd..599b8d2fe11 100644 >--- a/lib/util/memcache.c >+++ b/lib/util/memcache.c >@@ -209,12 +209,33 @@ static void memcache_delete_element(struct memcache *cache, > memcache_element_parse(e, &cache_key, &cache_value); > SMB_ASSERT(cache_value.length == sizeof(ptr)); > memcpy(&ptr, cache_value.data, sizeof(ptr)); >+ if (cache == global_cache) { >+ DEBUG(0,("1 : cache->size = 0x%" PRIx64 " to del = 0x%x\n", >+ cache->size, >+ (unsigned int)talloc_total_size(ptr))); >+ if (cache->size < talloc_total_size(ptr)) { >+ smb_panic("bad size\n"); >+ } >+ } > cache->size -= talloc_total_size(ptr); > TALLOC_FREE(ptr); > } > >+ if (cache == global_cache) { >+ DEBUG(0,("2 : cache->size = 0x%" PRIx64 " to del = 0x%x\n", >+ cache->size, >+ (unsigned int)memcache_element_size(e->keylength, e->valuelength))); >+ if (cache->size < memcache_element_size(e->keylength, e->valuelength)) { >+ smb_panic("bad size\n"); >+ } >+ } > cache->size -= memcache_element_size(e->keylength, e->valuelength); > >+ if (cache == global_cache) { >+ DEBUG(0,("3 : AFTER-DEL cache->size = 0x%" PRIx64 "\n", >+ cache->size)); >+ } >+ > TALLOC_FREE(e); > } > >@@ -224,9 +245,21 @@ static void memcache_trim(struct memcache *cache) > return; > } > >+ if (cache == global_cache) { >+ DEBUG(0,("4 : memcache_trim: max_size = 0x%x cache->size = 0x%" PRIx64 " HEAD=%p, TAIL=%p\n", >+ (unsigned int)cache->max_size, >+ (uint64_t)cache->size, >+ cache->mru, >+ DLIST_TAIL(cache->mru))); >+ } >+ > while ((cache->size > cache->max_size) && DLIST_TAIL(cache->mru)) { > memcache_delete_element(cache, DLIST_TAIL(cache->mru)); > } >+ if (cache == global_cache) { >+ DEBUG(0,("4a : AFTER memcache_trim: new cache->size = 0x%" PRIx64 "\n", >+ (uint64_t)cache->size)); >+ } > } > > void memcache_delete(struct memcache *cache, enum memcache_number n, >@@ -279,6 +312,14 @@ static void memcache_do_add(struct memcache *cache, enum memcache_number n, > void *ptr; > SMB_ASSERT(cache_value.length == sizeof(ptr)); > memcpy(&ptr, cache_value.data, sizeof(ptr)); >+ if (cache == global_cache) { >+ DEBUG(0,("5 : cache->size = 0x%" PRIx64 " to del = 0x%x\n", >+ cache->size, >+ (unsigned int)talloc_total_size(ptr))); >+ if (cache->size < talloc_total_size(ptr)) { >+ smb_panic("bad size\n"); >+ } >+ } > cache->size -= talloc_total_size(ptr); > TALLOC_FREE(ptr); > } >@@ -329,8 +370,20 @@ static void memcache_do_add(struct memcache *cache, enum memcache_number n, > > DLIST_ADD(cache->mru, e); > >+ if (cache == global_cache) { >+ DEBUG(0,("6 : ADD: cache->size = 0x%" PRIx64 " adding = 0x%x\n", >+ cache->size, >+ (unsigned int)(element_size + talloc_size))); >+ } >+ > cache->size += element_size; > cache->size += talloc_size; >+ >+ if (cache == global_cache) { >+ DEBUG(0,("7 : ADD: New cache->size = 0x%" PRIx64 "\n", >+ cache->size)); >+ } >+ > memcache_trim(cache); > } > >diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm >index 647a3b50dfc..9301b4988c7 100755 >--- a/selftest/target/Samba3.pm >+++ b/selftest/target/Samba3.pm >@@ -1396,7 +1396,7 @@ sub check_or_start($$$$$) { > } > > $ENV{MAKE_TEST_BINARY} = Samba::bindir_path($self, "smbd"); >- my @optargs = ("-d0"); >+ my @optargs = ("-d10"); > if (defined($ENV{SMBD_OPTIONS})) { > @optargs = split(/ /, $ENV{SMBD_OPTIONS}); > } >diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c >index a97d8d44930..0035a39c58d 100644 >--- a/source3/locking/share_mode_lock.c >+++ b/source3/locking/share_mode_lock.c >@@ -284,6 +284,13 @@ static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx, > d->sequence_number, > file_id_string(mem_ctx, &id)); > >+ //JRATEST >+ if (memcache_lookup_talloc(NULL, >+ SHARE_MODE_LOCK_CACHE, >+ key) != NULL) { >+ smb_panic("found deleted entry\n"); >+ } >+ //JRATEST > return d; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13865
:
15021
| 15023 |
15050
|
15051