Skip to content

[C++][FlightRPC] Support Unloading For Arrow Libraries Used by Flight SQL ODBC in MSVC #48270

Open

Description

@alinaliBQ

Describe the enhancement requested

Add the unloading support for Arrow Libraries Used by Flight SQL ODBC in MSVC platforms. These libraries are:

  • Arrow Compute
  • Arrow Flight
  • Arrow Flight SQL

Currently, we are seeing segmentation fault errors occurring during the unload of Arrow.DLL, it is due to the Arrow Compute library.

Log:

>	arrow.dll!std::_Ref_count_base::_Decref() Line 1160	C++
 	arrow.dll!std::_Ptr_base<arrow::compute::Function>::_Decref() Line 1385	C++
 	arrow.dll!std::shared_ptr<arrow::compute::Function>::~shared_ptr<arrow::compute::Function>() Line 1690	C++
 	arrow.dll!std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>::~pair<std::string const ,std::shared_ptr<arrow::compute::Function>>()	C++
 	arrow.dll!std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>::`scalar deleting destructor'(unsigned int)	C++
 	arrow.dll!std::destroy_at<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>(std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>> * const _Location) Line 337	C++
 	arrow.dll!std::_Default_allocator_traits<std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>>>::destroy<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>(std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>> & __formal, std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>> * const _Ptr) Line 739	C++
 	arrow.dll!std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>::_Freenode<std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>>>(std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>> & _Al, std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *> * _Ptr) Line 318	C++
 	arrow.dll!std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>::_Free_non_head<std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>>>(std::allocator<std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *>> & _Al, std::_List_node<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,void *> * _Head) Line 329	C++
 	arrow.dll!std::list<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>>::_Tidy() Line 1519	C++
 	arrow.dll!std::list<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>>::~list<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>>() Line 1063	C++
 	arrow.dll!std::_Hash<std::_Umap_traits<std::string,std::shared_ptr<arrow::compute::Function>,std::_Uhash_compare<std::string,std::hash<std::string>,std::equal_to<std::string>>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>,0>>::~_Hash<std::_Umap_traits<std::string,std::shared_ptr<arrow::compute::Function>,std::_Uhash_compare<std::string,std::hash<std::string>,std::equal_to<std::string>>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>,0>>()	C++
 	arrow.dll!std::unordered_map<std::string,std::shared_ptr<arrow::compute::Function>,std::hash<std::string>,std::equal_to<std::string>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>>::~unordered_map<std::string,std::shared_ptr<arrow::compute::Function>,std::hash<std::string>,std::equal_to<std::string>,std::allocator<std::pair<std::string const ,std::shared_ptr<arrow::compute::Function>>>>()	C++
 	arrow.dll!arrow::compute::FunctionRegistry::FunctionRegistryImpl::~FunctionRegistryImpl() Line 40	C++
 	arrow.dll!arrow::compute::FunctionRegistry::FunctionRegistryImpl::`scalar deleting destructor'(unsigned int)	C++
 	arrow.dll!std::default_delete<arrow::compute::FunctionRegistry::FunctionRegistryImpl>::operator()(arrow::compute::FunctionRegistry::FunctionRegistryImpl * _Ptr) Line 3309	C++
 	arrow.dll!std::unique_ptr<arrow::compute::FunctionRegistry::FunctionRegistryImpl,std::default_delete<arrow::compute::FunctionRegistry::FunctionRegistryImpl>>::~unique_ptr<arrow::compute::FunctionRegistry::FunctionRegistryImpl,std::default_delete<arrow::compute::FunctionRegistry::FunctionRegistryImpl>>() Line 3427	C++
 	arrow.dll!arrow::compute::FunctionRegistry::~FunctionRegistry() Line 230	C++
 	arrow.dll!arrow::compute::FunctionRegistry::`scalar deleting destructor'(unsigned int)	C++
 	arrow.dll!std::default_delete<arrow::compute::FunctionRegistry>::operator()(arrow::compute::FunctionRegistry * _Ptr) Line 3309	C++
 	arrow.dll!std::unique_ptr<arrow::compute::FunctionRegistry,std::default_delete<arrow::compute::FunctionRegistry>>::~unique_ptr<arrow::compute::FunctionRegistry,std::default_delete<arrow::compute::FunctionRegistry>>() Line 3427	C++
 	arrow.dll!`arrow::compute::GetFunctionRegistry'::`2'::`dynamic atexit destructor for 'g_registry''()	C++
 	ucrtbased.dll!_execute_onexit_table::__l2::<lambda>() Line 206	C++
 	ucrtbased.dll!__crt_seh_guarded_call<int>::operator()<void <lambda>(void),int <lambda>(void) &,void <lambda>(void)>(__acrt_lock_and_call::__l2::void <lambda>(void) && setup, _execute_onexit_table::__l2::int <lambda>(void) & action, __acrt_lock_and_call::__l2::void <lambda>(void) && cleanup) Line 204	C++
 	ucrtbased.dll!__acrt_lock_and_call<int <lambda>(void)>(const __acrt_lock_id lock_id, _execute_onexit_table::__l2::int <lambda>(void) && action) Line 983	C++
 	ucrtbased.dll!_execute_onexit_table(_onexit_table_t * table) Line 231	C++
 	arrow.dll!__scrt_dllmain_uninitialize_c() Line 398	C++
 	arrow.dll!dllmain_crt_process_detach(const bool is_terminating) Line 182	C++
 	arrow.dll!dllmain_crt_dispatch(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 220	C++
 	arrow.dll!dllmain_dispatch(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 293	C++
 	arrow.dll!_DllMainCRTStartup(HINSTANCE__ * const instance, const unsigned long reason, void * const reserved) Line 335	C++
 	ntdll.dll!LdrpCallInitRoutineInternal()	Unknown
 	ntdll.dll!LdrpCallInitRoutine()	Unknown
 	ntdll.dll!LdrShutdownProcess()	Unknown
 	ntdll.dll!RtlExitUserProcess()	Unknown
 	kernel32.dll!ExitProcessImplementation()	Unknown
 	ucrtbased.dll!exit_or_terminate_process(const unsigned int return_code, bool should_call_terminate_proc) Line 142	C++
 	ucrtbased.dll!common_exit(const int return_code, const _crt_exit_cleanup_mode cleanup_mode, const _crt_exit_return_mode return_mode) Line 288	C++
 	ucrtbased.dll!exit(int return_code) Line 302	C++
 	arrow-flight-sql-odbc-test.exe!__scrt_common_main_seh() Line 295	C++
 	arrow-flight-sql-odbc-test.exe!__scrt_common_main() Line 331	C++
 	arrow-flight-sql-odbc-test.exe!mainCRTStartup(void * __formal) Line 17	C++
 	kernel32.dll!BaseThreadInitThunk()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown

Component(s)

FlightRPC, C++

Activity

  1. alinaliBQ commented on Jan 28, 2026

    @alinaliBQ
    CollaboratorAuthor

    As of Jan 2026, I see the segmentation fault in ODBC is gone. I think the underlying issues in the Arrow libraries have been fixed in the recent updates.

  2. changed the title [-]Support Unloading For Arrow Libraries Used by Flight SQL ODBC in MSVC[/-] [+][C++][FlightRPC] Support Unloading For Arrow Libraries Used by Flight SQL ODBC in MSVC[/+] on Apr 20, 2026
  3. alinaliBQ commented on Apr 20, 2026

    @alinaliBQ
    CollaboratorAuthor

    As of Apr 2026, we are seeing this error again in #49784, and the workaround is to add arrow::compute::Initialize() in the test global environment of arrow-flight-sql-odbc-test. This means ODBC will not register compute function calls during run time, as the compute calls are already registered during set up. The ODBC driver’s runtime registration behavior is not being tested.

    In a real world scenario, the expected behavior of ODBC driver is to register compute function calls, so timestamp to string conversions etc are enabled for data fetching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions