confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
68 stars 861 forks source link

Can't load moinitoring-interceptor plugin in .NET #549

Closed mhowlett closed 6 years ago

mhowlett commented 6 years ago

Description

From the Kafka mailing list:

I'm trying to get stream monitoring set up for a producer in .NET 4.6, and I've followed the instructors for adding interceptors here: https://docs.confluent.io/current/control-center/docs/installation/clients.html

Unfortunately, I get an exception when it attempts to load the module: {"LoadLibrary() failed: The specified module could not be found... (plugin monitoring-interceptor)"}

I know it finds the library, because if I swap it out for the x86 version (I'm running x64) I get an 'not a valid Win32 application' error instead.

I've inspected the dll with Depends to see if I can track down a possible missing dependency, but I'm getting nowhere. I'm stuck at this point. Any ideas?

mhowlett commented 6 years ago

the symptoms do sound like a dependency issue to me, but i don't know why that would be if librdkafka itself is working.

what windows version are you using, and have you tried running on a different machine?

JocelynAtIgloo commented 6 years ago

I'm running Windows 10. I had a coworker try it on Server 2012R2, and his also failed, but he got an error about ucrtbased.dll missing on his machine.

I should have that dll on my machine as part of my Windows 10 install, but I don't seem to have it either. Reinstalled my Windows 10 sdk, but no dice. Going to see if there's somewhere else I should be getting this dll.

mhowlett commented 6 years ago

hmm.. the machine I verified the .dlls on is running Windows 10 x64, and has Visual Studio 2015 and 2017 installed. I believe @edenhill is using VS 2015 to build the library. Maybe try installing the Visual C++ 2015 redistributable https://www.microsoft.com/en-us/download/details.aspx?id=52685 or Visual Studio 2015.

JocelynAtIgloo commented 6 years ago

Tried the 2015 redistrib, but it fails (I think because I have 2017 installed). I uninstalled VS2015 a few months back, maybe it took some things with it.

Installed the latest Windows 10 sdk (10.0.17134.12) and we're off to the races. Thanks for the help!

mhowlett commented 6 years ago

closing because because i believe it's probably an unusual set of circumstances that caused this issue to occur. will re-open if others run into this.

mhowlett commented 6 years ago

if you've arrived at this page because you're experiencing a similar issue, it might be worth double checking you've specified the path to the monitoring interceptor .dll file correctly.

srinathrangaramanujam commented 5 years ago

I am getting the same error

SSarver commented 5 years ago

I'm getting the same error and have confirmed the path is correct. The error also tells me the path it is looking in, which is correct. Any ideas on what to do here?

edenhill commented 5 years ago

What version of the monitoring-interceptors are you trying to use? 0.11.0 or 0.11.1?

russau commented 4 years ago

For anyone arriving here using this library with dotnetcore macOS: I was getting a very similar error. The fix was to uninstall / re-install the librdkafa installed by brew.

mhowlett commented 4 years ago

thanks for noting that @russau

did you try without librdkafka installed via brew at all (rely on Confluent.Kafka's librdkafka.resist dependency)?

russau commented 4 years ago

Hello @mhowlett - it's now all working for me with brew's librdkafka 1.3.0 and nuget's Confluent.Kafka 1.3.0.

If I brew uninstall librdkafka I get the following error when I run my dotnetcore app

Unhandled exception. System.ArgumentException: dlopen() failed: dlopen(monitoring-interceptor.dylib, 6): Library not loaded: /usr/local/opt/librdkafka/lib/librdkafka.1.dylib.  Referenced from: /usr/local/lib/monitoring-interceptor.dylib.  Reason: image not found (plugin monitoring-interceptor)

The app does then work with no PluginLibraryPaths configured.

RKochenderfer commented 1 year ago

I am encountering this issue using Windows with .NET 6. I verified that I only have one version of librdkafka installed, version 1.9.2, and that path that is being shown in the error is the correct path to the project's bin file.