Skip to content

Avoid core while extracting error message from future w/NULL response.#292

Merged
mpenick merged 3 commits intoapache:masterfrom
angelcaban:master
Jun 8, 2016
Merged

Avoid core while extracting error message from future w/NULL response.#292
mpenick merged 3 commits intoapache:masterfrom
angelcaban:master

Conversation

@angelcaban
Copy link
Copy Markdown
Contributor

When attempting to get future error result from future without response, got the following stack trace:

#0  0x00007ffff10d5f7d in boost::atomics::detail::base_atomic<int, int, 4u, true>::fetch_add (this=0x8, v=1, order=boost::memory_order_relaxed)
    at include/boost/atomic/detail/gcc-x86.hpp:612
#1  0x00007ffff10d48d8 in cass::Atomic<int>::fetch_add (this=0x8, value=1, order=cass::MEMORY_ORDER_RELAXED)
    at cpp-driver/src/atomic/atomic_boost.hpp:48
#2  0x00007ffff10dd236 in cass::RefCounted<cass::Response>::inc_ref (this=0x8) at cpp-driver/src/ref_counted.hpp:42
#3  0x00007ffff114fcda in cass_future_get_error_result (future=0x7fff780017c0) at cpp-driver/src/future.cpp:101
#4  0x00007ffff6f7b179 in cassutils::buildErrorFromFuture (pFuture=0x7fff780017c0, errorOut="Invalid query") at 

@datastax-bot
Copy link
Copy Markdown

Hi @angelcaban, thanks for your contribution!

In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes.

Sincerely,
DataStax Bot.

@datastax-bot
Copy link
Copy Markdown

Thank you @angelcaban for signing the Contribution License Agreement.

Cheers,
DataStax Bot.

Comment thread src/future.cpp Outdated
}

result->inc_ref();
if (result) result->inc_ref();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This line could probably be moved into the previous check.

   if (result) {
      result->decode_first_row();
      result->inc_ref();  // Move it here
    }

Comment thread src/future.cpp
*value = reinterpret_cast<const cass_byte_t*>(item.value.data());
*value_size = item.value.size();
return CASS_OK;
return CASS_ERROR_LIB_INTERNAL_ERROR;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating a new error for this? I skimmed over the existing errors codes and couldn't find one that fits this type of error. I'm thinking something like 'CASS_ERROR_LIB_RESPONSE_NOT_AVAILABLE`.

@mpenick mpenick merged commit 8e63849 into apache:master Jun 8, 2016
mikefero added a commit that referenced this pull request Oct 25, 2019
* msvc: Enable warnings for implicit casts and address problems
* clang: Enable warnings for implicit casts and address problems
* `-Wconversion` for GCC is unsustainable; see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752 for more context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants