Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when using odbcConnection.GetSchema #30647

Closed
abelykh0 opened this issue Aug 15, 2019 · 7 comments
Closed

Segmentation fault when using odbcConnection.GetSchema #30647

abelykh0 opened this issue Aug 15, 2019 · 7 comments
Labels
area-System.Data.Odbc backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity

Comments

@abelykh0
Copy link

The example below crashes with Segmentation fault on Linux. This is not a regression, it is also crashing with .NET Core 2.2

using System;
using System.Data;
using System.Data.Odbc;
namespace ConsoleApp32
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Driver={MySQL};Server=dbtest;Database=sakila;UID=root;PWD=****;";
            using (OdbcConnection connection = new OdbcConnection(connectionString))
            {
                connection.Open();
                int rows = 0;
                using (DataTable schemaTable = connection.GetSchema(
                        "Tables",
                    new string[] { null, null, "BAD" }))
                {
                    rows = schemaTable.Rows.Count;
                }
                Console.WriteLine("rows={0}", rows);
            }
        }
    }
}

If you use either valid table name (like "film"), or null instead of "BAD", it works correctly.

Environment:

$dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview8-013656
 Commit:    8bf06ffc8d

Runtime Environment:
 OS Name:     rhel
 OS Version:  7
 OS Platform: Linux
 RID:         rhel.7-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100-preview8-013656/

Host (useful for support):
  Version: 3.0.0-preview8-28405-07
  Commit:  d01b2fb7bc

.NET Core SDKs installed:
  3.0.100-preview8-013656 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview8-28405-07 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
@danmoseley
Copy link
Member

Can you get a stack trace indicating what native frame is at the top?

@abelykh0
Copy link
Author

I don't know how to read seg faults. Please give me instructions. The dotnet executable crashes.

@danmoseley
Copy link
Member

@abelykh0
Copy link
Author

This is what I am getting. Please let me know if I need to run anything else:

(lldb) dumpstack
OS Thread Id: 0x1002 (1)
TEB information is not available so a stack size of 0xFFFF is assumed
Current frame: libmyodbc5.so!my_SQLFreeStmtExtended + 0x224
Child-SP         RetAddr          Caller, Callee
00007FFE36D40F00 00007f957e60e63d (MethodDesc 00007f957ef2b130 + 0x8d ILStubClass.)
00007FFE36D40F40 00007f957e60e63d (MethodDesc 00007f957ef2b130 + 0x8d ILStubClass.)
00007FFE36D40FA0 00007f957e60e576 (MethodDesc 00007f957ef20480 + 0x26 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling 00007f957cfbd878 (stub for /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D40FC0 00007f957e60e4c4 (MethodDesc 00007f957ef1ec70 + 0x54 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling (MethodDesc 00007f957ef20480 + 0 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41010 00007f957e60ded7 (MethodDesc 00007f957ef1d8c0 + 0xd7 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling (MethodDesc 00007f957ef1ec70 + 0 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41060 00007f957e60ddda (MethodDesc 00007f957ef1d8d8 + 0x2a /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling (MethodDesc 00007f957ef1d8c0 + 0 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41090 00007f957e602f61 (MethodDesc 00007f957e2c6300 + 0x171 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D410C0 00007f957e602f25 (MethodDesc 00007f957e2c6300 + 0x135 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling (MethodDesc 00007f957e2c6300 + 0x144 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41140 00007f957e602561 (MethodDesc 00007f957e2c6348 + 0x71 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown), calling (MethodDesc 00007f957e2c6300 + 0 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41180 00007f957e601f07 (MethodDesc 00007f957e2c5778 + 0x1a7 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D411D0 00007f957cfbfe1d (MethodDesc 00007f957de66100 + 0x5d /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41220 00007f957cfbf991 (MethodDesc 00007f957d0c5a78 + 0x71 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown)
00007FFE36D41260 00007f957cfb2397 (MethodDesc 00007f957d0623d0 + 0xf7 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/ConsoleApp32.dll!Unknown)
00007FFE36D412F0 00007f95f63baa7f libcoreclr.so!CallDescrWorkerInternal + 0x7c [/__w/1/s/src/pal/inc/unixasmmacrosamd64.inc:870]
(lldb) clrstack
OS Thread Id: 0x1002 (1)
        Child SP               IP Call Site
00007FFE36D40F20 00007f95efc8cb74 [InlinedCallFrame: 00007ffe36d40f20] /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D40F20 00007f957e60e63d [InlinedCallFrame: 00007ffe36d40f20] /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D40F10 00007F957E60E63D ILStubClass.
00007FFE36D40FB0 00007F957E60E576 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D40FD0 00007F957E60E4C4 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D41020 00007F957E60DED7 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D41070 00007F957E60DDDA /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown

@abelykh0
Copy link
Author

Another one, seems it has more info:

(lldb) clrstack -f
OS Thread Id: 0x1002 (1)
        Child SP               IP Call Site
00007FFE36D40DC0 00007F95EFC8CB74 libmyodbc5.so!my_SQLFreeStmtExtended + 548
00007FFE36D40DF0 00007F95F02E4725 libodbc.so.2!SQLFreeStmt + 405
00007FFE36D40F10 00007F957E60E63D 
00007FFE36D40F20                  [InlinedCallFrame: 00007ffe36d40f20] /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D40F20                  [InlinedCallFrame: 00007ffe36d40f20] /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown
00007FFE36D40F10 00007F957E60E63D ILStubClass. + 141
00007FFE36D40FB0 00007F957E60E576 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown + 38
00007FFE36D40FD0 00007F957E60E4C4 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown + 84
00007FFE36D41020 00007F957E60DED7 /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown + 215
00007FFE36D41070 00007F957E60DDDA /trunk/ConsoleApp32/ConsoleApp32/bin/Debug/netcoreapp3.0/runtimes/linux/lib/netcoreapp2.0/System.Data.Odbc.dll!Unknown + 42
00007FFE36D41090 00007F957D30FEE9 
00007FFE36D410A0 00007F957E602F61 
00007FFE36D41150 00007F957E602561 
00007FFE36D41190 00007F957E601F07 
00007FFE36D411E0 00007F957CFBFE1D 
00007FFE36D41230 00007F957CFBF991 
00007FFE36D41270 00007F957CFB2397 
00007FFE36D41300 00007F95F63BAA7F libcoreclr.so!CallDescrWorkerInternal + 124 at /__w/1/s/src/pal/inc/unixasmmacrosamd64.inc:870
00007FFE36D41320 00007F95F62EAEF5 libcoreclr.so!CallDescrWorkerWithHandler(CallDescrData*, int) + 117 at /__w/1/s/src/pal/inc/pal.h:5081
00007FFE36D41360 00007F95F62EB9D0 libcoreclr.so!MethodDescCallSite::CallTargetWorker(unsigned long const*, unsigned long*, int) + 1264 at /__w/1/s/src/vm/callhelpers.cpp:604
00007FFE36D41530 00007F95F63CF3F2 libcoreclr.so!RunMain(MethodDesc*, short, int*, PtrArray**) + 786 at /__w/1/s/src/vm/callhelpers.h:468
00007FFE36D41530 00007F95F63CF3DB libcoreclr.so!RunMain(MethodDesc*, short, int*, PtrArray**) + 763 at /__w/1/s/src/vm/callhelpers.h:468
00007FFE36D41530 00007F95F63CF276 libcoreclr.so!RunMain(MethodDesc*, short, int*, PtrArray**) + 406 at /__w/1/s/src/vm/assembly.cpp:1529
00007FFE36D41530 00007F95F63CF21F libcoreclr.so!RunMain(MethodDesc*, short, int*, PtrArray**) + 319 at /__w/1/s/src/vm/threads.inl:34
00007FFE36D41750 00007F95F63CF6F0 libcoreclr.so!Assembly::ExecuteMainMethod(PtrArray**, int) + 272 at /__w/1/s/src/vm/assembly.cpp:1681
00007FFE36D41A60 00007F95F6237E61 libcoreclr.so!CorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int*) + 577 at /__w/1/s/src/vm/corhost.cpp:461
00007FFE36D41B50 00007F95F6210C34 libcoreclr.so!coreclr_execute_assembly + 212 at /__w/1/s/src/dlls/mscoree/unixinterface.cpp:412
00007FFE36D41BB0 00007F95F68EB1C3 libhostpolicy.so!run_app_for_context(hostpolicy_context_t const&, int, char const**) + 755 at /root/coresetup/src/corehost/cli/hostpolicy/hostpolicy.cpp:240
00007FFE36D41C50 00007F95F68EBA1C libhostpolicy.so!corehost_main + 204 at /root/coresetup/src/corehost/cli/hostpolicy/hostpolicy.cpp:389
00007FFE36D41D20 00007F95F6B4FB10 libhostfxr.so!fx_muxer_t::handle_exec_host_command(std::string const&, host_startup_info_t const&, std::string const&, std::unordered_map<known_options, std::vector<std::string, std::allocator<std::string> >, known_options_hash, std::equal_to<known_options>, std::allocator<std::pair<known_options const, std::vector<std::string, std::allocator<std::string> > > > > const&, int, char const**, int, host_mode_t, char*, int, int*) + 1536 at /root/coresetup/src/corehost/cli/fxr/fx_muxer.cpp:146
00007FFE36D41D20 00007F95F6B4F9FB libhostfxr.so!fx_muxer_t::handle_exec_host_command(std::string const&, host_startup_info_t const&, std::string const&, std::unordered_map<known_options, std::vector<std::string, std::allocator<std::string> >, known_options_hash, std::equal_to<known_options>, std::allocator<std::pair<known_options const, std::vector<std::string, std::allocator<std::string> > > > > const&, int, char const**, int, host_mode_t, char*, int, int*) + 1259 at /root/coresetup/src/corehost/cli/fxr/fx_muxer.cpp:87
00007FFE36D41D20 00007F95F6B4F9FB libhostfxr.so!fx_muxer_t::handle_exec_host_command(std::string const&, host_startup_info_t const&, std::string const&, std::unordered_map<known_options, std::vector<std::string, std::allocator<std::string> >, known_options_hash, std::equal_to<known_options>, std::allocator<std::pair<known_options const, std::vector<std::string, std::allocator<std::string> > > > > const&, int, char const**, int, host_mode_t, char*, int, int*) + 1259 at /root/coresetup/src/corehost/cli/fxr/fx_muxer.cpp:87
00007FFE36D41E30 00007F95F6B4E6A3 libhostfxr.so!fx_muxer_t::execute(std::string, int, char const**, host_startup_info_t const&, char*, int, int*) + 691 at /root/coresetup/src/corehost/cli/fxr/fx_muxer.cpp:541
00007FFE36D41F10 00007F95F6B496F3 libhostfxr.so!hostfxr_main_startupinfo + 147 at /root/coresetup/src/corehost/cli/fxr/hostfxr.cpp:33
00007FFE36D41F80 000000000040C441 dotnet!exe_start(int, char const**) + 785 at /root/coresetup/src/corehost/corehost.cpp:216
00007FFE36D42010 000000000040C9FE dotnet!main + 142 at /root/coresetup/src/corehost/corehost.cpp:289
00007FFE36D42040 00007F95F6DA2545 libc.so.6!__libc_start_main + 245
00007FFE36D42100 0000000000402F40 dotnet!_start + 41

@jeffschwMSFT jeffschwMSFT transferred this issue from dotnet/coreclr Aug 21, 2019
@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 26, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.0, Future Jun 23, 2020
@ajcvickers ajcvickers removed the untriaged New issue has not been triaged by the area owner label Jun 23, 2020
Copy link
Contributor

Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

This process is part of our issue cleanup automation.

@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Dec 23, 2024
Copy link
Contributor

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

@dotnet-policy-service dotnet-policy-service bot removed this from the Future milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Data.Odbc backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity
Projects
None yet
Development

No branches or pull requests

7 participants