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

Karthikeyan Manivannan commented on DRILL-5448:
-----------------------------------------------

Sorabh and I took an initial stab at this. The failure is because the error 
message buffer in Drill::ErrorMessages::getMessage can only handle 10240 
characters. The error message, in this case, is about 32k. This seems to be 
causing the segfault. No idea why this only occurs if the drillbit is busy.

(lldb) process launch --stop-at-entry -- -program_arg querySubmitter  
query='select * from hive.voter_text' logLevel=trace type=sql 
connectStr=local=10.10.102.81:31010 api=sync  
saslPluginPath='/Users/karthik/lib' user=karthik password=maprmapr1234
...
...
lldb) br s -n 
'Drill::DrillClientError::getErrorObject(exec::shared::DrillPBError const&)' 
Breakpoint 1: where = 
libdrillClient.dylib`Drill::DrillClientError::getErrorObject(exec::shared::DrillPBError
 const&) + 15 at drillClient.cpp:33, address = 0x000000010017021f
(lldb) r
There is a running process, kill it and restart?: [Y/n] Y
Process 28268 exited with status = 9 (0x00000009) 
Process 36577 launched: 
'/Users/karthik/git-sources/drill-fork/contrib/native/client/build/querySubmitter'
 (x86_64)
Unknown option:-program_arg. Ignoring
Unknown option:querySubmitter. Ignoring
Connected!

Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x000000010017021f 
libdrillClient.dylib`Drill::DrillClientError::getErrorObject(e=0x00000001008013d0)
 + 15 at drillClient.cpp:33, stop reason = breakpoint 1.1
    frame #0: 0x000000010017021f 
libdrillClient.dylib`Drill::DrillClientError::getErrorObject(e=0x00000001008013d0)
 + 15 at drillClient.cpp:33
   30   namespace Drill{
   31   
   32   DrillClientError* DrillClientError::getErrorObject(const 
exec::shared::DrillPBError& e){
-> 33       std::string s=Drill::getMessage(ERR_QRY_FAILURE, 
e.message().c_str());
   34       DrillClientError* err=NULL;
   35       err=new DrillClientError(QRY_FAILURE, QRY_ERROR_START+QRY_FAILURE, 
s);
   36       return err;
(lldb) step
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x000000010017047c 
libdrillClient.dylib`exec::shared::DrillPBError::message(this=0x00000001008013d0)
 const + 12 at UserBitShared.pb.h:3409, stop reason = step in
    frame #0: 0x000000010017047c 
libdrillClient.dylib`exec::shared::DrillPBError::message(this=0x00000001008013d0)
 const + 12 at UserBitShared.pb.h:3409
   3406   clear_has_message();
   3407 }
   3408 inline const ::std::string& DrillPBError::message() const {
-> 3409   return *message_;
   3410 }
   3411 inline void DrillPBError::set_message(const ::std::string& value) {
   3412   set_has_message();
(lldb) p *message
warning: could not load any Objective-C class information. This will 
significantly reduce the quality of type information available.
error: reference to non-static member function must be called; did you mean to 
call it with no arguments?
error: indirection requires pointer operand ('const string' (aka 'const 
std::__1::basic_string<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >') invalid)
(lldb) p *message_
(std::__1::string) $6 = "SYSTEM ERROR: AccessControlException: User 
karthik(user id 503)  does not have access to 
maprfs:///user/hive/warehouse/voter_text\n\n\n[Error Id: 
7efda71b-f55b-45b4-a040-a59b0fd059a7 on qa102-81.qa.lab:31010]\n\n  
(org.apache.drill.exec.work.foreman.ForemanException) Unexpected exception 
during fragment initialization: Internal error: Error while applying rule 
DrillPushProjIntoScan, args 
[rel#15120:LogicalProject.NONE.ANY([]).[](input=rel#15119:Subset#0.ENUMERABLE.ANY([]).[],voter_id=$0,name=$1,age=$2,registration=$3,contributions=$4,voterzone=$5,create_timestamp=$6,create_date=$7),
 rel#15110:EnumerableTableScan.ENUMERABLE.ANY([]).[](table=[hive, 
voter_text])]\n    org.apache.drill.exec.work.foreman.Foreman.run():298\n    
java.util.concurrent.ThreadPoolExecutor.runWorker():1142\n    
java.util.concurrent.ThreadPoolExecutor$Worker.run():617\n    
java.lang.Thread.run():745\n  Caused By (java.lang.AssertionError) Internal 
error: Error while applying rule DrillPushProjIntoScan, args 
[rel#15120:LogicalProject.NONE.ANY([]).[]"...
(lldb) p message_.size()
(std::__1::basic_string<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >::size_type) $7 = 32737
  Fix-it applied, fixed expression was: 
    message_->size()
(lldb) p message_->size()
(std::__1::basic_string<char, std::__1::char_traits<char>, 
std::__1::allocator<char> >::size_type) $8 = 32737
(lldb) step
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x0000000100170228 
libdrillClient.dylib`Drill::DrillClientError::getErrorObject(e=0x00000001008013d0)
 + 24 at drillClient.cpp:33, stop reason = step in
    frame #0: 0x0000000100170228 
libdrillClient.dylib`Drill::DrillClientError::getErrorObject(e=0x00000001008013d0)
 + 24 at drillClient.cpp:33
   30   namespace Drill{
   31   
   32   DrillClientError* DrillClientError::getErrorObject(const 
exec::shared::DrillPBError& e){
-> 33       std::string s=Drill::getMessage(ERR_QRY_FAILURE, 
e.message().c_str());
   34       DrillClientError* err=NULL;
   35       err=new DrillClientError(QRY_FAILURE, QRY_ERROR_START+QRY_FAILURE, 
s);
   36       return err;
(lldb) 
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x00000001002ac073 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 339 at errmsgs.cpp:76, 
stop reason = step in
    frame #0: 0x00000001002ac073 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 339 at errmsgs.cpp:76
   73   
   74   std::string getMessage(uint32_t msgId, ...){
   75       char str[10240];
-> 76       std::string s;
   77       assert((ERR_NONE <= msgId) && (msgId < ERR_QRY_MAX));
   78       va_list args;
   79       va_start (args, msgId);
(lldb) n
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x00000001002ac163 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 579 at errmsgs.cpp:77, 
stop reason = step over
    frame #0: 0x00000001002ac163 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 579 at errmsgs.cpp:77
   74   std::string getMessage(uint32_t msgId, ...){
   75       char str[10240];
   76       std::string s;
-> 77       assert((ERR_NONE <= msgId) && (msgId < ERR_QRY_MAX));
   78       va_list args;
   79       va_start (args, msgId);
   80       vsprintf (str, errorMessages[msgId-DRILL_ERR_START].msgFormatStr, 
args);
(lldb) 
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x00000001002ac1e1 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 705 at errmsgs.cpp:79, 
stop reason = step over
    frame #0: 0x00000001002ac1e1 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 705 at errmsgs.cpp:79
   76       std::string s;
   77       assert((ERR_NONE <= msgId) && (msgId < ERR_QRY_MAX));
   78       va_list args;
-> 79       va_start (args, msgId);
   80       vsprintf (str, errorMessages[msgId-DRILL_ERR_START].msgFormatStr, 
args);
   81       va_end (args);
   82       
s=std::string("[")+boost::lexical_cast<std::string>(msgId)+std::string("]")+str;
(lldb) 
Process 36577 stopped
* thread #2: tid = 0x1c2a096, 0x00000001002ac207 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 743 at errmsgs.cpp:80, 
stop reason = step over
    frame #0: 0x00000001002ac207 
libdrillClient.dylib`Drill::getMessage(msgId=30029) + 743 at errmsgs.cpp:80
   77       assert((ERR_NONE <= msgId) && (msgId < ERR_QRY_MAX));
   78       va_list args;
   79       va_start (args, msgId);
-> 80       vsprintf (str, errorMessages[msgId-DRILL_ERR_START].msgFormatStr, 
args);
   81       va_end (args);
   82       
s=std::string("[")+boost::lexical_cast<std::string>(msgId)+std::string("]")+str;
   83       return s;
(lldb) p args
(va_list) $9 = {
  [0] = (gp_offset = 16, fp_offset = 48, overflow_arg_area = 
0x000070000007fa60, reg_save_area = 0x000070000007cff0)
}
(lldb) p (int *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
(int *) $10 = 0x000070000007d000
(lldb) p *(int *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
(int) $11 = 33723904
(lldb) p "%s" *(int *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
error: invalid operands to binary expression ('const char *' and 'int *')
(lldb) p "%s", (int *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
(int *) $12 = 0x000070000007d000
(lldb) expr (int) printf("%s", (int *)(((char 
*)args[0].reg_save_area)+args[0].gp_offset));
(int) $13 = 0
(lldb) expr (int) printf("%s", "foo")
(int) $14 = 3
(lldb) expr (int) printf("%s", "food")
(int) $15 = 4
(lldb) expr (int) printf("%s", "")
(int) $16 = 0
(lldb) set a =5
error: 'settings append' takes more arguments
(lldb) set a=5
error: unknown command shorthand suffix: '=5'
ambiguous command 'set'. Possible completions:
        settings
(lldb) p "%s", (char *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
(char *) $17 = 0x000070000007d000 <no value available>
(lldb) p  *(char *)(((char *)args[0].reg_save_area)+args[0].gp_offset)
(char) $18 = '\0'
(lldb) 


> ODBC client crashed when user does not have access to text formatted hive 
> table
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-5448
>                 URL: https://issues.apache.org/jira/browse/DRILL-5448
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - C++
>    Affects Versions: 1.10.0, 1.11.0
>            Reporter: Krystal
>
> While many connections are connecting to the drillbit, odbc client crashed 
> with "Segmentation Fault" while executing a select from a hive table in text 
> format that the user does not have access to.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to