MySQL Forums
Forum List  »  Connector/C++

Re: read access violation in xdevapi 8.0.17
Posted by: Rafal Somla
Date: December 17, 2019 08:12AM

Hi John,

Yes, you can only execute one query at a time in a single session. However, you should get proper mysqlx::Error thrown if you try another query before previous one was finished.

The stack trace which you showed in your original report suggests something else happening. The access violation in mysqlx::Reply::has_results() method is when de-referencing m_session member at the end of this method.

bool Reply::has_results()
if (NULL == m_session)
return false;

assert(this == m_session->m_current_reply);

// If we hit error, do not continue.

if (entry_count() > 0)
return false;


// If server reported error, we do not have any results.

if (entry_count() > 0)
return false;

return m_session->m_has_results;

Note that m_session is checked for NULL at the beginning of this method. So probably the same result object was deleted in a concurrent thread (m_session is reset in mysqlx::Reply::discard() which is called from the dtor).

I don't know how this could happen, because the fragments of code you posted do not explain how the tasks you create are executed in the end. The tasks are defined by lambdas that refer to shared pointers pointing at X DevAPI objects. When the tasks are created, nothing is run yet and no queries are sent to the server. This happens when the task gets executed, but you do not show how your code executes it. Can it happen that the same task is executed by two different threads? If yes, that could be one possible explanation. But otherwise all your shared ptr gymnastic, even if it could be avoided or simplified, should be OK and should ensure that required objects are available when needed.

I see you posted one more interesting comment related to this, but on a different thread (,680721,682527#msg-682527 - probably by mistake?). I will reply to that as well in a short while.

Options: ReplyQuote

Written By
November 20, 2019 04:57PM
Re: read access violation in xdevapi 8.0.17
December 17, 2019 08:12AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.