Invalid query causes an ANTLR and czar crashes

Description

Checklist

Lucidchart Diagrams

Issue Matrix

hide

Activity

Igor Gaponenko 
November 22, 2016 at 3:43 PM

I've reviewed the changes, and they all make a sense to me.

John Gates 
November 18, 2016 at 12:48 PM

Maybe the constructor is doing too much is the wrong way to put it, but it was trying to do a lot things that are pointless when the query is already know to be invalid. This is the second time I've been in this code for a czar crash in the last 5 months, which is why I just moved it out of the constructor. We should discuss what really needs to happen with registration of invalid queries and what this code should do.

Andy Salnikov 
November 18, 2016 at 12:38 PM

OK, I disagree with "constructor doing too much" statement, but the whole UserQuerySelect construction process is a mess which leaves things in inconsistent state this is why we see this crash. And I'm not sure that this fix fixes all those issues, we'll need to review the whole thing at some point (I tried to improve it when I migrated czar to C++ but obviously I did not succeed).

For the record, I dug a little bit to see where it crashes, here is gdb backtrace:

(basically QuerySession::getProxyOrderBy() SEGVs when session is in "error" state, which is wrong).

I'm OK with the current fix if it helps PDAC to move forward, but we do need to improve that code a lot. , please mark the ticket reviewed when you are satisfied.

John Gates 
November 18, 2016 at 11:26 AM

What would happen before is that an invalid query would be passed into the constructor for UserQuerySelect and then call _qMetaRegister with some bad information, and it would blow up in _qMetaRegister. I didn't check what actually caused the problem in qMetaRegister, but I can see a few way things could go south with looking up non--existent tables and so forth. The change here only calls qMetaRegister if the query is reasonably valid, side stepping many possible errors, and is better in that I thought the constructor was doing too much anyway.

Andy Salnikov 
November 18, 2016 at 11:03 AM

, I'm not quite sure why this fix fixes it. Can you explain it a bit, did the crash happen because of uncaught exception or was it a SEGV?

Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Reviewers

Andy Salnikov
Igor Gaponenko

Story Points

RubinTeam

Sprint

Checklist

Created November 16, 2016 at 3:59 PM
Updated November 28, 2016 at 2:45 PM
Resolved November 28, 2016 at 2:45 PM