ssett / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

pause 'in window 2012 libtcmalloc_minimal use. #610

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. libtcmalloc_minimal in vs2012 using Debug window server 2012 R2 version of 
the executable

2. Has the program stop state (main () does not call.)

3. 아래는 호출 스택을 보면 tcmalloc::ThreadCache::InitModule()이 왜 
2번 호출 되는지 모르겠습니다.
   Release 로 실행하면 정상적으로 작동됩니다. 

    libtcmalloc_minimal-debug.dll!SpinLock::SlowLock() 줄 107  C++
    libtcmalloc_minimal-debug.dll!SpinLock::Lock() 줄 73   C++
    libtcmalloc_minimal-debug.dll!SpinLockHolder::SpinLockHolder(SpinLock * l) 줄 136  C++
    libtcmalloc_minimal-debug.dll!tcmalloc::ThreadCache::InitModule() 줄 309   C++
    libtcmalloc_minimal-debug.dll!tcmalloc::ThreadCache::GetCache() 줄 420 C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc_no_errno(unsigned int size) 줄 1097 C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc(unsigned int size) 줄 1104  C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc_or_cpp_alloc(unsigned int size) 줄 1024 C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::LibcInfoWithPatchFunctions<0>::Perftools_malloc(unsigned int size) 줄 797 C++
    msvcr110d.dll!__crtCompareStringA_stat(localeinfo_struct * plocinfo, const wchar_t * LocaleName, unsigned long dwCmpFlags, const char * lpString1, int cchCount1, const char * lpString2, int cchCount2, int code_page) 줄 202 C++
    msvcr110d.dll!__crtCompareStringA(localeinfo_struct * plocinfo, const wchar_t * LocaleName, unsigned long dwCmpFlags, const char * lpString1, int cchCount1, const char * lpString2, int cchCount2, int code_page) 줄 278  C++
    msvcr110d.dll!_mbsnbicoll_l(const unsigned char * s1, const unsigned char * s2, unsigned int n, localeinfo_struct * plocinfo) 줄 75    C++
    msvcr110d.dll!_mbsnbicoll(const unsigned char * s1, const unsigned char * s2, unsigned int n) 줄 87    C++
    msvcr110d.dll!_getenv_helper_nolock(const char * option) 줄 154    C
    msvcr110d.dll!getenv(const char * option) 줄 83    C
    libtcmalloc_minimal-debug.dll!tcmalloc::InitTCMallocTransferNumObjects() 줄 53 C++
    libtcmalloc_minimal-debug.dll!tcmalloc::SizeMap::Init() 줄 124 C++
    libtcmalloc_minimal-debug.dll!tcmalloc::Static::InitStaticVars() 줄 89 C++
    libtcmalloc_minimal-debug.dll!tcmalloc::ThreadCache::InitModule() 줄 312   C++
    libtcmalloc_minimal-debug.dll!tcmalloc::ThreadCache::GetCache() 줄 420 C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc_no_errno(unsigned int size) 줄 1097 C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc(unsigned int size) 줄 1104  C++
    libtcmalloc_minimal-debug.dll!`anonymous namespace'::do_malloc_or_cpp_alloc(unsigned int size) 줄 1024 C++
    libtcmalloc_minimal-debug.dll!tc_malloc(unsigned int size) 줄 1563 C++
    libtcmalloc_minimal-debug.dll!TCMallocGuard::TCMallocGuard() 줄 910    C++
    libtcmalloc_minimal-debug.dll!`dynamic initializer for 'module_enter_exit_hook''() 줄 938  C++
    msvcr110d.dll!_initterm(void (void) * * pfbegin, void (void) * * pfend) 줄 894 C
    libtcmalloc_minimal-debug.dll!_CRT_INIT(void * hDllHandle, unsigned long dwReason, void * lpreserved) 줄 295   C
    libtcmalloc_minimal-debug.dll!__DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) 줄 502 C
    libtcmalloc_minimal-debug.dll!_DllMainCRTStartup(void * hDllHandle, unsigned long dwReason, void * lpreserved) 줄 472  C
    ntdll.dll!77922e7e()    알 수 없음
    [아래 프레임은 올바르지 않거나 누락되었거나 ntdll.dll에 대해 로드된 기호가 없음]  
    ntdll.dll!77922ed4()    알 수 없음
    ntdll.dll!779393bc()    알 수 없음
    ntdll.dll!77939258()    알 수 없음
    ntdll.dll!77939ae8()    알 수 없음
    ntdll.dll!7794262e()    알 수 없음
    ntdll.dll!7791c0fc()    알 수 없음

What version of the product are you using? On what operating system?

gperftools-2.1
vs 2012 
windows 2012 R2

Original issue reported on code.google.com by nerv8...@gmail.com on 6 Mar 2014 at 10:48

GoogleCodeExporter commented 9 years ago
3. Below is a look at the call stack tcmalloc :: ThreadCache :: InitModule () 
is being called twice I do not know why.
When you run the Release to work properly.

Original comment by nerv8...@gmail.com on 6 Mar 2014 at 10:53

GoogleCodeExporter commented 9 years ago
Can you please try latest code from master ?

It's quite plausibly still fail but I'd like to know for certain.

Regarding reason, it does look like order of modules initialization causes 
getenv to be called early or late enough. And getenv on some C runtime versions 
appears to call malloc.

Notably on my msvc 2012 I am unable to hit this problem (probably because of 
slightly different order of initialization).

Original comment by alkondratenko on 6 Mar 2014 at 1:41

GoogleCodeExporter commented 9 years ago
git receives the latest version of the code to be tested, but the same problem 
occurs.

Vs2012 in Windows 7, no problems.

However, in Windows Server 2012 R2 build vs2012 debug only when the problem 
occurs.

Did you ever check in Windows Server 2012 R2?

Original comment by nerv8...@gmail.com on 6 Mar 2014 at 3:03

GoogleCodeExporter commented 9 years ago
>> Did you ever check in Windows Server 2012 R2?

No I have not.

Thanks for information.

Original comment by alkondratenko on 6 Mar 2014 at 3:04

GoogleCodeExporter commented 9 years ago
Issue 542 has been merged into this issue.

Original comment by alkondratenko on 6 Mar 2014 at 3:05

GoogleCodeExporter commented 9 years ago
It looks like non-ascii locale is causing it. That's why I'm unable to 
reproduce it locally.

And given that I'm don't have guts to try to set some multibyte encoding in 
windows I cannot reproduce it at all.

Thankfully ms ships source code of their C runtime. Looking at source I now see 
that in locales with multibyte encodings it will apparently call malloc from 
inside getenv all the time when there's environment variable which name matches 
length of what we're getenv-ing.

With that observation I think I'll just disable uses of getenv on windows to 
keep us out of trouble.

Thanks for raising it.

Original comment by alkondratenko on 12 Apr 2014 at 10:30

GoogleCodeExporter commented 9 years ago
I've implemented what I think is a fix for this problem. Consider testing it 
please (I cannot due to inability to have multibyte locale on windows).

The code is here: https://github.com/alk/gperftools/tree/wip-issue-610

Original comment by alkondratenko on 13 Apr 2014 at 1:13

GoogleCodeExporter commented 9 years ago
Testing was thinking this issue is resolved happened.

When will the full version of this version happens to apply?

Thank you resolve.

Original comment by nerv8...@gmail.com on 14 Apr 2014 at 1:28

GoogleCodeExporter commented 9 years ago
I've just released 2.1rc with the fix. Consider testing please.

Original comment by alkondratenko on 19 Apr 2014 at 8:35