kevingurney commented on code in PR #34563:
URL: https://github.com/apache/arrow/pull/34563#discussion_r1164681643


##########
matlab/tools/cmake/BuildMatlabArrowInterface.cmake:
##########
@@ -0,0 +1,80 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# -------
+# Config
+# -------
+
+# Build configuration for libmexclass.
+set(CUSTOM_PROXY_FACTORY_INCLUDE_DIR 
"${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy;${CMAKE_SOURCE_DIR}/src/cpp")
+set(CUSTOM_PROXY_FACTORY_SOURCES 
"${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/proxy/factory.cc")
+set(CUSTOM_PROXY_SOURCES 
"${CMAKE_SOURCE_DIR}/src/cpp/arrow/matlab/array/proxy/float64_array.cc")
+set(CUSTOM_PROXY_INCLUDE_DIR 
"${CMAKE_SOURCE_DIR}/src/cpp;${ARROW_INCLUDE_DIR}")
+set(CUSTOM_PROXY_LINK_LIBRARIES ${ARROW_LINK_LIB})
+# On Windows, arrow.dll must be installed regardless of
+# whether Arrow_FOUND is true or false. Therefore, we explicitly
+# copy ARROW_SHARED_LIB to the installation folder +libmexclass/+proxy.
+set(CUSTOM_PROXY_RUNTIME_LIBRARIES ${ARROW_SHARED_LIB})
+set(CUSTOM_PROXY_FACTORY_HEADER_FILENAME "factory.h")
+set(CUSTOM_PROXY_FACTORY_CLASS_NAME "arrow::matlab::proxy::Factory")

Review Comment:
   **Update**: We've spent several days worth of effort trying to get to the 
root cause of what's causing the crash and have determined the following:
   
   1. The crash doesn't appear to be related to a breaking change in the Arrow 
C++ libraries. What we thought we were seeing before was actually a false 
positive. It turns out that we were accidentally building in `Debug` mode when 
qualifying the changes on Windows, which was triggering the crash. The crash 
occurs regardless of whether a new or old version of the Arrow C++ libraries 
are used. In addition, the crash does **not** occur when building in `Release` 
mode.
   
   2. Unfortunately, it seems like the crash is being caused by some kind of 
memory corruption. We stepped through the code in the Visual Studio debugger 
and the call to `array->ToString()` in `float64_array.cc` returns the expected 
`std::string` value representing the contents of the `arrow::Array`. However, 
right after `ToString()` returns, the returned `std::string` value memory 
becomes filled with random characters, and then, MATLAB crashes. At this point, 
we have yet to identify the source of the memory corruption.
    
   3. We have been experimenting with instrumenting the code using 
[`AddressSanitizer`](https://github.com/google/sanitizers/wiki/AddressSanitizer)
 to determine the root cause of the apparent memory corruption.
   
   ---
   
   In order to unblock this pull request, it may make sense to treat this as an 
independent issue. Since the crash doesn't seem to occur in `Release` mode on 
Windows, the crash shouldn't prevent further progress on the MATLAB Interface 
to Arrow for now.
   
   We will work on addressing the remaining comments on this PR while trying to 
debug this crash further in parallel.
   
   We apologize for the delay on getting to the root cause of this issue.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to