Code Monkey home page Code Monkey logo

Comments (9)

tamizhvendan avatar tamizhvendan commented on August 21, 2024

I guess it is something similar to this issue. Some internal code while initializing the type provider is causing the issue. I tried to attach debugger and troubleshoot but it didn't work out as we can't open more than one instance of VS for Mac :(

Is there any way that I can troubleshoot this to find the actual error?

from rezoom.sql.

rspeele avatar rspeele commented on August 21, 2024

Hi,

Thanks for the bug report. A good way to troubleshoot it further would be to use the type provider from a .fsx script file and attach the debugger to fsi.exe. Rezoom.SQL.Provider has an example of this if you F5 it in debug configuration.

from rezoom.sql.

tamizhvendan avatar tamizhvendan commented on August 21, 2024

Thanks @rspeele

Unfortunately, it didn't work!

image


/~/temp/Rezoom.SQL/src/Rezoom.SQL.Provider/user.fsx(15,10): error FS3033: The type provider 'Rezoom.SQL.Provider.Provider' reported an error: Object reference not set to an instance of an object

mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
Stacktrace:

  at <unknown> <0xffffffff>
  at System.IO.KqueueMonitor.CleanUp () [0x00053] in <70507a44a84041d599bbfa8f3d0ea5b1>:0
  at System.IO.KqueueMonitor.DoMonitor () [0x00051] in <70507a44a84041d599bbfa8f3d0ea5b1>:0
  at System.IO.KqueueMonitor.<Start>b__5_0 () [0x00000] in <70507a44a84041d599bbfa8f3d0ea5b1>:0
  at System.Threading.ThreadHelper.ThreadStart_Context (object) [0x00014] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object) [0x0002b] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0
  at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x0004d] in <c9f8153c41de4f8cbafd0e32f9bf6b28>:0

Native stacktrace:

	0   mono                                0x000000010f9f6061 mono_handle_native_crash + 257
	1   libsystem_platform.dylib            0x00007fff8c5afb3a _sigtramp + 26
	2   ???                                 0x000070000cd9bfe0 0x0 + 123145517907936
	3   libsystem_c.dylib                   0x00007fff8c434420 abort + 129
	4   mono                                0x000000010fbcd591 mono_log_write_logfile + 353
	5   mono                                0x000000010fbe4740 monoeg_g_log + 208
	6   mono                                0x000000010fac63d1 mono_marshal_find_in_cache + 129
	7   mono                                0x000000010face23f mono_marshal_get_native_wrapper + 223
	8   mono                                0x000000010f9456f0 mono_jit_compile_method_inner + 384
	9   mono                                0x000000010f94884a mono_jit_compile_method_with_opt + 714
	10  mono                                0x000000010f9f866f common_call_trampoline + 1199
	11  mono                                0x000000010f9f8189 mono_magic_trampoline + 73
	12  ???                                 0x000000010fdad39e 0x0 + 4560966558
	13  ???                                 0x0000000118e3a5c9 0x0 + 4712539593
	14  ???                                 0x0000000118d8aa1e 0x0 + 4711819806
	15  ???                                 0x0000000118d8a7f5 0x0 + 4711819253
	16  mscorlib.dll.dylib                  0x00000001119cde11 System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool + 33
	17  mono                                0x000000010f94c505 mono_jit_runtime_invoke + 2245
	18  mono                                0x000000010fb4dd48 do_runtime_invoke + 88
	19  mono                                0x000000010fb19a9e start_wrapper + 766
	20  libsystem_pthread.dylib             0x00007fff8c5b993b _pthread_body + 180
	21  libsystem_pthread.dylib             0x00007fff8c5b9887 _pthread_body + 0
	22  libsystem_pthread.dylib             0x00007fff8c5b908d thread_start + 13

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.TCzxrT'
Executing commands in '/tmp/mono-gdb-commands.TCzxrT'.
(lldb) process attach --pid 32058
error: attach failed: unable to attach

The application was terminated by a signal: SIGHUP

from rezoom.sql.

tamizhvendan avatar tamizhvendan commented on August 21, 2024

I tried to troubleshoot this using printfn as suggested.

For this code in user.fsx

type QueryWithNullablePar = SQL<"""
    select * from Users u
    where u.Name is @name
""", "user-migrations">

I put printfn in these places

Provider.fs

do
        printfn "initializing #2" // <----

        let tys = [ sqlTy; modelTy ]
        tmpAssembly.AddTypes(tys)
        this.AddNamespace(rootNamespace, tys)
        modelCache.Invalidated.Add(fun _ -> this.Invalidate())
        this.Disposing.Add(fun _ -> modelCache.Dispose())

        printfn "init success" // <----

    static do

        printfn "initializing #1" // <----

        System.AppDomain.CurrentDomain.add_AssemblyResolve(fun _ args ->
            AssemblyResolver.resolve args.Name |> Option.toObj)

TypeGeneration.fs

let generateSQLType (generate : GenerateType) (sql : string) =
  printfn "generating SQL Type" // <----
  // ...
  provided.AddMember <| generateCommandMethod generate commandEffect commandType commandCtorMethod

    printfn "generated SQL type" // <----

    provided

Here is the output that I got

initializing #1
initializing #2
init success
generating SQL Type
generated SQL type

/Users/tamizhvendan/TamizhWorks/temp/Rezoom.SQL/src/Rezoom.SQL.Provider/user.fsx(15,29): error FS3033: The type provider 'Rezoom.SQL.Provider.Provider' reported an error: Object reference not set to an instance of an object

I guess I am able to troubleshoot it using printfn. It would be helpful if you can help me in placing the print statements in the codebase to identify the root cause

from rezoom.sql.

rspeele avatar rspeele commented on August 21, 2024

I haven't the slightest clue where that NRE might be coming from, but I think using this event handler to do some logging might help you obtain a useful stack trace:

https://msdn.microsoft.com/en-us/library/system.appdomain.firstchanceexception.aspx

from rezoom.sql.

tamizhvendan avatar tamizhvendan commented on August 21, 2024

Unfortunately, it didn't trap the exception!

Hi @ovatsus, @andrevdm, Can you folks help here? it is similar to the Fsharp.Data issue but we couldn't able to debug/troubleshoot it

from rezoom.sql.

tamizhvendan avatar tamizhvendan commented on August 21, 2024

@rspeele Is it because of the error being discussed in SO

from rezoom.sql.

rspeele avatar rspeele commented on August 21, 2024

Leaving a note here that this might fix it:

fsprojects/FSharp.TypeProviders.SDK#121

I'm on Windows only at the moment and not able to quickly repro the original issue so I can't tell if upgrading the ProvidedTypes.fs helps at all.

from rezoom.sql.

Swoorup avatar Swoorup commented on August 21, 2024

I tested on ubuntu with Mono 6.0.0 Preview and 5.20.1 Stable (5.20.1.19). Can confirm we still run into the same issue.

from rezoom.sql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.