You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Cliff Jansen (JIRA)" <ji...@apache.org> on 2011/06/06 21:58:59 UTC
[jira] [Updated] (QPID-3256) Application which uses Qpid (in my
case Excel) hangs on shutdown
[ https://issues.apache.org/jira/browse/QPID-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cliff Jansen updated QPID-3256:
-------------------------------
Attachment: qpid-3256.patch
> Application which uses Qpid (in my case Excel) hangs on shutdown
> ----------------------------------------------------------------
>
> Key: QPID-3256
> URL: https://issues.apache.org/jira/browse/QPID-3256
> Project: Qpid
> Issue Type: Bug
> Components: C++ Client
> Affects Versions: 0.8, 0.10
> Environment: OS: Windows.
> Qpid is assembled as DLL.
> Reporter: Eugene
> Assignee: Cliff Jansen
> Attachments: qpid-3256.patch
>
>
> Hi All
> I encountered with strange behavior on shutdown when using qpid 0-8 and 0-10.
> When I use qpid in standalone console-application everything is ok. But when I use qpid in DLL which is loaded into Excel (as RTD module), Excel hangs on shutdown.
> I found out that in standalone application on shutdown I have next stack:
> qpidclientd.dll!qpid::client::`anonymous namespace'::IOThread::~IOThread() Line 138 C++
> qpidclientd.dll!`qpid::client::`anonymous namespace'::theIO'::`2'::`dynamic atexit destructor for 'io''() + 0xd bytes C++
> qpidclientd.dll!_CRT_INIT(void * hDllHandle=0x60080000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 449 C
> qpidclientd.dll!__DllMainCRTStartup(void * hDllHandle=0x60080000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 560 + 0x11 bytes C
> qpidclientd.dll!_DllMainCRTStartup(void * hDllHandle=0x60080000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 510 + 0x11 bytes C
> ntdll.dll!77b79960()
> [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> ntdll.dll!77b9a516()
> ntdll.dll!77b9a3b8()
> kernel32.dll!77657363()
> msvcr90d.dll!__crtExitProcess(int status=0) Line 732 C
> msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0) Line 644 + 0x9 bytes C
> msvcr90d.dll!exit(int code=0) Line 412 + 0xd bytes C
> Test.exe!__tmainCRTStartup() Line 599 C
> Test.exe!mainCRTStartup() Line 403 C
> kernel32.dll!77653677()
> ntdll.dll!77b79f02()
> ntdll.dll!77b79ed5()
> And in this state all threads of application have been already terminated. The only thread is:
> 1 > 21720 Main Thread Main Thread qpid::client::`anonymous namespace'::IOThread::~IOThread Normal 0
> so code from file ConnectionImpl.cpp works well:
> ~IOThread() {
> std::vector<Thread> threads;
> {
> ScopedLock<Mutex> l(threadLock);
> if (poller_)
> poller_->shutdown();
> t.swap(threads);
> }
> for (std::vector<Thread>::iterator i = threads.begin(); i != threads.end(); ++i) {
> i->join();
> }
> }
> BUT in Excel I get stack:
> qpidclientd.dll!qpid::client::`anonymous namespace'::IOThread::~IOThread() Line 130 C++
> qpidclientd.dll!`qpid::client::`anonymous namespace'::theIO'::`2'::`dynamic atexit destructor for 'io''() + 0xd bytes C++
> qpidclientd.dll!_CRT_INIT(void * hDllHandle=0x07700000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 449 C
> qpidclientd.dll!__DllMainCRTStartup(void * hDllHandle=0x07700000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 560 + 0x11 bytes C
> qpidclientd.dll!_DllMainCRTStartup(void * hDllHandle=0x07700000, unsigned long dwReason=0, void * lpreserved=0x00000000) Line 510 + 0x11 bytes C
> ntdll.dll!77b79960()
> [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
> ntdll.dll!77ba1525()
> ntdll.dll!77b81231()
> KernelBase.dll!77281da7()
> ole32.dll!75bb9562()
> ole32.dll!75bb9593()
> ole32.dll!75bb95a7()
> ole32.dll!75bb98bf()
> ole32.dll!75bb9805()
> ole32.dll!75bb9a8c()
> EXCEL.EXE!2f3811e9()
> EXCEL.EXE!2f6933e8()
> EXCEL.EXE!2f32a5af()
> EXCEL.EXE!2f34894a()
> EXCEL.EXE!2f670001()
> MSO.DLL!65bc6ed5()
> MSO.DLL!65c26a34()
> MSO.DLL!65c30305()
> MSO.DLL!65bc910c()
> MSO.DLL!65c4f420()
> MSO.DLL!65bbf161()
> comctl32.dll!7233463d()
> user32.dll!762971be()
> user32.dll!76297d31()
> user32.dll!76297dfa()
> EXCEL.EXE!2f324572()
> EXCEL.EXE!2f324534()
> EXCEL.EXE!2f324441()
> MSO.DLL!65b78116()
> MSO.DLL!65ba1fd0()
> EXCEL.EXE!2f30424b()
> msvcr90.dll!749936c5()
> msvcr90.dll!749938b3()
> msvcr90.dll!749938c5()
> msvcr90.dll!749ac40c()
> msvcr90.dll!749b028d()
> msvcr90.dll!749b04f3()
> EXCEL.EXE!2f303f0a()
> kernel32.dll!77653677()
> ntdll.dll!77b79f02()
> ntdll.dll!77b79ed5()
> And threads:
> 0 24016 Worker Thread _threadstartex _threadstartex Normal 0
> 0 > 22928 Main Thread Main Thread qpid::client::`anonymous namespace'::IOThread::~IOThread Normal 0
> 0 20224 RPC Thread RPC Callback Thread 77b5fd21 Normal 0
> 0 16492 Worker Thread Win32 Thread 77b61ed6 Normal 0
> 0 19948 Worker Thread Win32 Thread 77b600ed Normal 0
> 0 20524 Worker Thread Win32 Thread 77b61ed6 Normal 0
> 0 20532 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 21500 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 21848 Worker Thread Win32 Thread 77b61ed6 Normal 0
> 0 22152 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 22164 Worker Thread Win32 Thread 77b5f8e9 Normal 0
> 0 22300 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 22360 Worker Thread Win32 Thread 77b61ed6 Normal 0
> 0 23316 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 23556 Worker Thread Win32 Thread 77b5f8e9 Normal 0
> 0 23700 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 23912 Worker Thread Win32 Thread 77b5f8e9 Normal 0
> 0 24276 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 24308 Worker Thread Win32 Thread 77b5f861 Normal 0
> 0 24424 Worker Thread Win32 Thread 77b600ed Normal 0
> 0 24452 Worker Thread Win32 Thread 77b5f8e9 Normal 0
> 0 24520 Worker Thread Win32 Thread 77b61ed6 Normal 0
> As result this code (below) hangs application(Excel):
> ~IOThread() {
> std::vector<Thread> threads;
> {
> ScopedLock<Mutex> l(threadLock);
> if (poller_)
> poller_->shutdown();
> t.swap(threads);
> }
> for (std::vector<Thread>::iterator i = threads.begin(); i != threads.end(); ++i)
> {
> i->join();-- APPLICATION HANGS HERE !!!!
> }
> }
> I suppose it occurs because of qpid tries to wait of thread completing from _DllMainCRTStartup which is called with PROCESS_DETACH.
> To work around it I modified function IOThread::sub():
> void sub() {
> std::vector<Thread> threads;
> {
> ScopedLock<Mutex> l(threadLock);
> --connections;
>
> if (connections == 0){
> if (poller_){
> poller_->shutdown();
> poller_.reset();
> t.swap(threads);
> }
> }
> }
> for (std::vector<Thread>::iterator i = threads.begin(); i != threads.end(); ++i) {
> i->join();
> }
> }
> But I don't think it is a good solution.
> Could you help me to solve this problem?
> Thanks
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org