You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Atanu Mishra (JIRA)" <ji...@apache.org> on 2015/08/14 03:13:45 UTC

[jira] [Commented] (TRAFODION-192) LP Bug: 1289524 - mxosrvr hangs after being idle for > 10 mins

    [ https://issues.apache.org/jira/browse/TRAFODION-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14696284#comment-14696284 ] 

Atanu Mishra commented on TRAFODION-192:
----------------------------------------

Aruna Sadashiva (aruna-sadashiva) on 2014-06-10
Changed in trafodion:
status:	Fix Committed → Fix Released


> LP Bug: 1289524 - mxosrvr hangs after being idle for > 10 mins
> --------------------------------------------------------------
>
>                 Key: TRAFODION-192
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-192
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-exe
>            Reporter: Aruna Sadashiva
>            Assignee: Hans Zeller
>            Priority: Critical
>
> Mxosrvr hangs and gets stuck in connected state if we run some sql stmts (ddl and dml) if its left idle for more than 10 mins. It is kind of intermittent, but happens most of the time.
> email discussion so far:
> I think this CLI is called duing endSession too. See arkcmp/CmpStatement.cpp. So, it is good to try out with this change.
> Selva
> From: Zeller, Hans 
> Sent: Thursday, March 06, 2014 4:59 PM
> To: Kakarlamudi, Rao; Omanski, Zbigniew; Govindarajan, Selvaganes; Capirala, Tharaknath; Narain, Arvind; Sadashiva, Aruna; Han, Yun (Henry,HPIT-GADSC)
> Cc: Hegde, Anuradha
> Subject: RE: 28-Feb Private Beta Refresh
> The only place I found where we call this SQL_EXEC_DeleteHbaseJNI() method is when we drop the Trafodion metadata.
> If that’s true, then the way to reproduce this hang would be the following:
> •         Do “initialize trafodion, drop” through an mxosrvr process. This will acquire two locks on the CLI semaphore for the main thread.
> •         Any number of other SQL statements
> •         Wait for this mxosrvr to time out, so that it tries to perform cleanup from another thread. That would deadlock.
> Aruna, is this something you tried? I tried to reproduce it, but couldn’t get the mxosrvr to deadlock. Not sure how exactly I can make the timeout happen.
> Thanks,
> Hans
> From: Zeller, Hans 
> Sent: Thursday, March 06, 2014 3:55 PM
> To: Kakarlamudi, Rao; Omanski, Zbigniew; Govindarajan, Selvaganes; Capirala, Tharaknath; Narain, Arvind; Sadashiva, Aruna; Han, Yun (Henry,HPIT-GADSC)
> Cc: Hegde, Anuradha
> Subject: RE: 28-Feb Private Beta Refresh
> Hi,
> Back to the semaphore problem and Selva’s question: Yes, it looks like the double get() that Selva found might be the problem. Looks like this CLI call could get two lock counts, then release one, and then another thread sharing the same context would be locked out forever.
> Should we build a new library with a fix, then give that to Aruna to test?
> Thanks,
> Hans
> From: Kakarlamudi, Rao 
> Sent: Thursday, March 06, 2014 3:54 PM
> To: Omanski, Zbigniew; Govindarajan, Selvaganes; Capirala, Tharaknath; Narain, Arvind; Zeller, Hans; Sadashiva, Aruna; Han, Yun (Henry,HPIT-GADSC)
> Cc: Hegde, Anuradha
> Subject: RE: 28-Feb Private Beta Refresh
> I believe Zbig is referring to the other mail... CR ID 7727 "JAD: HPDM showing too many child queries.
> From: Omanski, Zbigniew 
> Sent: Thursday, March 06, 2014 3:26 PM
> To: Govindarajan, Selvaganes; Capirala, Tharaknath; Narain, Arvind; Zeller, Hans; Sadashiva, Aruna; Han, Yun (Henry,HPIT-GADSC)
> Cc: Hegde, Anuradha; Kakarlamudi, Rao
> Subject: RE: 28-Feb Private Beta Refresh
> Hi Selva,
> I think that problems related to SQL Cancel are mainly because of race conditions when the WMS and RMS try to cancel the same child query. The explanation that RMS cancels parent and all child queries and WMS should only execute cancel on parent is what we should implement to fix that problem. 
> Thanks,
> Zbig
> From: Govindarajan, Selvaganes 
> Sent: Thursday, March 06, 2014 2:36 PM
> To: Capirala, Tharaknath; Narain, Arvind; Zeller, Hans; Sadashiva, Aruna; Omanski, Zbigniew
> Cc: Hegde, Anuradha; Kakarlamudi, Rao
> Subject: RE: 28-Feb Private Beta Refresh
> The implementation of CLI calls are within try-catch block to release the semaphore even when there is an abnormal exit from the lower level functions. Also, the longjmp concept is not used in SQ/Traf. So, it is not possible for the CLI to return without releasing the semaphore. I did some static reading to check if there is any mismatched lock and unlock. I just found that there is a mismatch in the sense that we lock twice, but unlock only once in SQL_EXEC_DeleteHbaseJNI in CliExtern.cpp
> We can correct this and try it out though this CLI is not called directly by mxosrvr.
> Hans, 
> Do you want to try out this change?
> --- CliExtern.cpp               (revision 37012)
> +++ CliExtern.cpp            (working copy)
> @@ -8539,7 +8539,6 @@
>        tmpSemaphore->get();
>        threadContext->incrNumOfCliCalls();
> -      tmpSemaphore->get();
>        HBaseClient_JNI::deleteInstance();
>     }
>     catch(...)
> Selva
> From: Capirala, Tharaknath 
> Sent: Thursday, March 06, 2014 12:28 AM
> To: Narain, Arvind; Govindarajan, Selvaganes; Zeller, Hans; Sadashiva, Aruna; Omanski, Zbigniew
> Cc: Hegde, Anuradha; Kakarlamudi, Rao
> Subject: RE: 28-Feb Private Beta Refresh
> Hi Selva,
> There are only two threads in MXOSRVR code that could invoke a CLI…one is the tcp/ip thread and the other is the main thread. As far as I can see the order of the mutex lock/unlock is being maintained as well. Also, the tcp/ip and the main thread cannot invoke a CLI simultaneously…this is controlled by the mutex protection that you are seeing in MXOSRVR cod
> I tried to debug a hung MXOSRVR session in my instance (Aruna had reproduced this for me earlier) and I see that the owner of the mutex being attempted in CLI off the main thread is pointing to the tcp/ip thread. So, looks like there was some CLI operation that probably did not release the mutex in the tcp/ip thread, which is still active?
> #3  0x00007ffff76c95be in EnterCriticalSection (
>     lpCriticalSection=0x7fffe5364060) at wincs.cpp:14
> 14          int lv_status = pthread_mutex_lock(lp_cs);
> (gdb) p lp_cs
> $2 = (pthread_mutex_t *) 0x7fffe5364060
> (gdb) p *lp_cs
> $3 = {__data = {__lock = 2, __count = 1, __owner = 5649, __nusers = 1,
>     __kind = 1, __spins = 0, __list = {__prev = 0x0, __next = 0x0}},
>   __size = "\002\000\000\000\001\000\000\000\021\026\000\000\001\000\000\000\001", '\000' <repeats 22 times>, __align = 4294967298}
> (gdb)
> Thread 24 (Thread 0x7fffe6867700 (LWP 5649)):
> #0  0x00000034c140e054 in __lll_lock_wait () from /lib64/libpthread.so.0
> #1  0x00000034c1409388 in _L_lock_854 () from /lib64/libpthread.so.0
> #2  0x00000034c1409257 in pthread_mutex_lock () from /lib64/libpthread.so.0
> #3  0x00007ffff5b3a96e in SB_Thread::Mutex::lock() () from /opt/home/tharakc/SVN_Projects/seaquest/sqf/export/lib64d/libsbutil.so
> #4  0x00007ffff5b3a9f0 in SB_Thread::Errorcheck_Mutex::lock() () from /opt/home/tharakc/SVN_Projects/seaquest/sqf/export/lib64d/libsbutil.so
> #5  0x00000000004e3b2d in CNSKListenerSrvr::tcpip_listener(void*) ()
> #6  0x00007ffff5b3b9cc in sb_thread_sthr_disp(void*) () from /opt/home/tharakc/SVN_Projects/seaquest/sqf/export/lib64d/libsbutil.so
> #7  0x00000034c1407851 in start_thread () from /lib64/libpthread.so.0
> #8  0x00000034c10e890d in clone () from /lib64/libc.so.6
> Tharak
> From: Govindarajan, Selvaganes 
> Sent: Wednesday, March 05, 2014 3:33 PM
> To: Zeller, Hans; Sadashiva, Aruna; Omanski, Zbigniew; Capirala, Tharaknath
> Subject: RE: 28-Feb Private Beta Refresh
> I debugged one of the hung mxosrvr process. There are two threads involving CLI – A tcp/ip listener thread and a main thread. Main thread is attempting to do sql when connection idle timeout kicked in.  Looking at the code, it looks like there are two mutex involved. One mutex within SQL and the other in mxosrvr code.  I wonder if we are  getting into deadlock because we are not locking/unlocking  in the same order.
> The preferred order would be
> Lock mxosrvr mutex
> Lock sql mutex  - Done by SQL  when a CLI is called
> Unlock sql mutex – Done by SQL just before CLI exits
> Unlock mxosrvr mutex
> Zbig, Tharak,
> Can you please confirm if the order is maintained in the mxosrvr code too. In the process that I debugged some other thread is holding the SQL mutex while main thread is trying to acquire it. The other thread that acquired may be the tcp/ip listener thread.  But the tcp/ip listener thread is not executing any CLI call. So, did any other thread executing a CLI terminate abnormally?
> Selva



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)