[ https://issues.apache.org/jira/browse/GEODE-9268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17372642#comment-17372642 ]
ASF GitHub Bot commented on GEODE-9268: --------------------------------------- gaussianrecurrence commented on a change in pull request #806: URL: https://github.com/apache/geode-native/pull/806#discussion_r662171627 ########## File path: cppcache/src/PdxLocalWriter.cpp ########## @@ -330,13 +330,13 @@ PdxWriter& PdxLocalWriter::markIdentityField(const std::string&) { return *this; } -uint8_t* PdxLocalWriter::getPdxStream(int& pdxLen) { - uint8_t* stPos = +std::vector<uint8_t> PdxLocalWriter::getPdxStream() { + uint8_t* buffer = const_cast<uint8_t*>(m_dataOutput->getBuffer()) + m_startPositionOffset; - int len = PdxHelper::readInt32 /*readByte*/ (stPos); - pdxLen = len; - // ignore len and typeid - return m_dataOutput->getBufferCopyFrom(stPos + 8, len); + int32_t len = PdxHelper::readInt32(buffer); + buffer += 8; + + return {buffer, buffer + len}; Review comment: You've got a pretty good point. I think I'll use the explicit construction, rather than the implicit, so it's more clear what's happening there. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Fix coredump whenever getFieldNames is called after a cluster restart > --------------------------------------------------------------------- > > Key: GEODE-9268 > URL: https://issues.apache.org/jira/browse/GEODE-9268 > Project: Geode > Issue Type: Bug > Components: native client > Reporter: Mario Salazar de Torres > Assignee: Mario Salazar de Torres > Priority: Major > Labels: pull-request-available > > *WHEN* A PdxInstance is fetched from a region > *AND* The whole cluster is restarted, triggering PdxTypeRegistry cleanup. > *AND* getFieldNames is called on the PdxInstance created just before > *THEN* a coredump happens. > — > *Additional information:* > Callstack: > {noformat} > [ERROR 2021/05/05 12:57:12.781834 CEST main (139683590957120)] Segmentation > fault happened > 0# handler(int) at nc-pdx/main.cpp:225 > 1# 0x00007F0A9F5F13C0 in /lib/x86_64-linux-gnu/libpthread.so.0 > 2# apache::geode::client::PdxType::getPdxFieldTypes() const at > cppcache/src/PdxType.hpp:181 > 3# apache::geode::client::PdxInstanceImpl::getFieldNames() at > cppcache/src/PdxInstanceImpl.cpp:1383 > 4# main at nc-pdx/main.cpp:374 > 5# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6 > 6# _start in build/pdx{noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)