raulcd commented on PR #47627:
URL: https://github.com/apache/arrow/pull/47627#issuecomment-3339121767

   ORC is not compiled with exception disabled. If I patch ORC removing the 
`std::call_once`, exceptions are properly propagated. The last commit patches 
ORC from vcpkg and provides a successful wheel for musllinux, all tests are 
successful. Below is the patch for an easier validation instead of the patch of 
a patch that we have on our `ports.patch`. I don't know if the patch is good 
enough but proves that there is an issue with exception propagation on 
musllinux with `std::call_once`, I would appreciate if someone can provide an 
alternative patch to avoid using `std::call_once` there. We might ask for the 
fix to be added on ORC:
   ```diff
   diff --git a/c++/src/Timezone.cc b/c++/src/Timezone.cc
   index 384f8ea99..0b58d0720 100644
   --- a/c++/src/Timezone.cc
   +++ b/c++/src/Timezone.cc
   @@ -695,13 +695,26 @@ namespace orc {
       private:
        std::string filename_;
        mutable std::unique_ptr<TimezoneImpl> impl_;
   -    mutable std::once_flag initialized_;
   +    mutable std::mutex init_mutex_;
   +    mutable bool initialized_ = false;
   +    mutable std::exception_ptr init_exception_;
    
        TimezoneImpl* getImpl() const {
   -      std::call_once(initialized_, [&]() {
   -        auto buffer = loadTZDB(filename_);
   -        impl_ = std::make_unique<TimezoneImpl>(filename_, 
std::move(buffer));
   -      });
   +      std::lock_guard<std::mutex> lock(init_mutex_);
   +      if (!initialized_) {
   +        try {
   +          auto buffer = loadTZDB(filename_);
   +          impl_ = std::make_unique<TimezoneImpl>(filename_, 
std::move(buffer));
   +          initialized_ = true;
   +        } catch (...) {
   +          init_exception_ = std::current_exception();
   +          initialized_ = true;
   +        }
   +      }
   +      // If initialization failed, re-throw the exception
   +      if (init_exception_) {
   +        std::rethrow_exception(init_exception_);
   +      }
          return impl_.get();
        }
    ```
   As per the bug reports pointed above, I am testing on amd64 (even though on 
CI I am testing the arm64 musllinux wheel) and all the local tests have been 
done with x86_64, the reported bugs all talk of non x86_64 architectures.


-- 
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