8000 Scary null pointer exception on close · Issue #107 · ah-/rdkafka-dotnet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Scary null pointer exception on close #107
Open
@haf

Description

@haf

When running this program:

module Worker.Program

open System
open System.Threading
open RdKafka

let utf8ToString =
  System.Text.Encoding.UTF8.GetString : byte[] -> string

[<EntryPoint>]
let main argv =
  use mre = new ManualResetEventSlim(false)
  use sub = Console.CancelKeyPress.Subscribe(fun _ ->
    printfn "Shutting down"
    mre.Set())
  let config = Config(GroupId = "example-csharp-consumer")
  use consumer = new EventConsumer(config, "127.0.0.1:9092")
  use msgs = consumer.OnMessage.Subscribe (fun msg ->
    let text = utf8ToString msg.Payload
    printfn "Topic: %s Partition: %i Offset: %i%s"
            msg.Topic
            msg.Partition
            msg.Offset
            text)
  consumer.Subscribe(ResizeArray<_> ["web-greetings"])
  consumer.Start()
  printfn "Running!"
  mre.Wait() |> ignore
  0

On mono 4.6.2 x64 on OS X 10.11.6 with brew update && brew install librdkafka, and then pressing CTRL+C, you get:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at RdKafka.Consumer.RebalanceCallback (System.IntPtr rk, RdKafka.ErrorCode err, System.IntPtr partitions, System.IntPtr opaque) [0x0003b] in <769a4254a9364d69b4b3250c87c60502>:0
  at (wrapper managed-to-native) RdKafka.Internal.LibRdKafka+NativeMethods:rd_kafka_destroy (intptr)
  at RdKafka.Internal.LibRdKafka.destroy (System.IntPtr rk) [0x00000] in <769a4254a9364d69b4b3250c87c60502>:0
  at RdKafka.Internal.SafeKafkaHandle.ReleaseHandle () [0x00000] in <769a4254a9364d69b4b3250c87c60502>:0
  at System.Runtime.InteropServices.SafeHandle.DangerousReleaseInternal (System.Boolean dispose) [0x000d2] in /private/tmp/mono-20161122-7959-s60tpx/mono-4.6.2/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:227
  at System.Runtime.InteropServices.SafeHandle.InternalFinalize () [0x0000b] in /private/tmp/mono-20161122-7959-s60tpx/mono-4.6.2/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:163
  at System.Runtime.InteropServices.SafeHandle.Dispose (System.Boolean disposing) [0x00011] in /private/tmp/mono-20161122-7959-s60tpx/mono-4.6.2/mcs/class/referencesource/mscorlib/system/runtime/interopservices/safehandle.cs:262
  at System.Runtime.InteropServices.SafeHandle.Finalize () [0x00000] in /private/tmp/mono-20161122-7959-s60tpx/mono-4.6.2/mcs/class/referencesource/mscorlib/system/runtime/interopservices/safehandle.cs:199

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0