question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting AccessViolaitonException

See original GitHub issue

Description

I very often get an AccessViolationException from Consumer when raising a cancellation with a CancellationToken instance passed into .Consume() method:

Consumer.Consume(cancellationToken);

Checklist

Please provide the following information:

  • [1.1.0 ] Confluent.Kafka nuget version.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexanderycommented, Aug 8, 2019

I’m seeing the exception when running in a debugger, so VS just breaks on the .Consume(cancellationToken) line and displays the exception pop-up.

I see that internally Consumer is doing cancellationToken.ThrowIfCancellationRequested(); and sometimes I get the related exception (OperationCanceledException), which I expect and process accordingly, but often I get the AccessViolationException, which can only be coming from ConsumeImpl() that interacts with librdkafka.

I’m running a test Net Core 2.2 console app, and that’s where I see the behavior.

But yes, I do have .Close() and wrap the message consumption in a try...catch..finally. So running outside of the debugger I’d be handling generic exception and moving on, but this is still concerning.

0reactions
AskMeAgaincommented, Sep 20, 2019

Its probl. to late, but if someone else is reading this: I think got this error when the consumer got disposed WHILE the Consume() happened. If you Dispose the consumer and then call consume, you get the normal ObjectDisposedException.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debugging System.AccessViolationException - DllImport hell
The exception typically happens when unmanaged code tries to read or write from/to memory that hasn't been allocated yet. Debugging System.
Read more >
c# - Programs randomly getting System. ...
6 Answers 6 · Go to the System properties (Win8: WinKey+X, select 'System', Win7: Open 'Properties' from my computer) · Advanced System Settings ......
Read more >
.NET Exceptions - System.AccessViolationException
AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt. To get the most ......
Read more >
Getting "accessviolationexception" error after ms access ...
You get an "Access violation" error when the process trying to open a file does not have sufficient permissions for it.
Read more >
Error : 'System.AccessViolationException' occurred in ...
While trying to run Samples with attached image. i am getting following error: An unhandled exception of type 'System.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found