Skip to content

StackOverflowException: new Error() #1249

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

Closed
4 of 8 tasks
cj-the-affable opened this issue Apr 14, 2020 · 5 comments
Closed
4 of 8 tasks

StackOverflowException: new Error() #1249

cj-the-affable opened this issue Apr 14, 2020 · 5 comments
Labels
bug investigate further we want to further investigate to understand properly

Comments

@cj-the-affable
Copy link
Contributor

cj-the-affable commented Apr 14, 2020

Description

In at least one situation, Error(IntPtr error) ctor causes a StackOverflowException. For my specific case, it was because the TransactionTimeout was set to a value that was too large.

Client Version: 1.4
OS: Windows 10

Stack Trace:

Confluent.Kafka.dll!Confluent.Kafka.Impl.Librdkafka.error_destroy(System.IntPtr error) Line 1301
Confluent.Kafka.dll!Confluent.Kafka.Impl.Librdkafka.error_destroy(System.IntPtr error) Line 1301
Confluent.Kafka.dll!Confluent.Kafka.Impl.Librdkafka.error_destroy(System.IntPtr error) Line 1301
Confluent.Kafka.dll!Confluent.Kafka.Impl.Librdkafka.error_destroy(System.IntPtr error) Line 1301
Confluent.Kafka.dll!Confluent.Kafka.Impl.Librdkafka.error_destroy(System.IntPtr error) Line 1301
Confluent.Kafka.dll!Confluent.Kafka.Error.Error(System.IntPtr error) Line 67
Confluent.Kafka.dll!Confluent.Kafka.Impl.SafeKafkaHandle.InitTransactions(int millisecondsTimeout) Line 495
Confluent.Kafka.dll!.Confluent.kafka.Producer.InitTransactions()

How to reproduce

using Confluent.Kafka;
using System;

namespace SimpleProject
{
    class Program
    {
        static void Main(string[] args)
        {
            const int TOO_LARGE_VALUE = 1000 * 60 * 60 * 5;
            var clientConfig = new ClientConfig()
            {
                BootstrapServers = "localhost:9092",
            };

            var producerConfig = new ProducerConfig(clientConfig)
            {
                TransactionalId = "test-trx-id",
                TransactionTimeoutMs = TOO_LARGE_VALUE
            };
            using (var producer = new ProducerBuilder<string, string>(producerConfig).Build())
            {
                producer.InitTransactions(TimeSpan.FromHours(5));
            }
        }
    }
}

Checklist

Please provide the following information:

  • A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • Confluent.Kafka nuget version.
  • Apache Kafka version.
  • Client configuration.
  • Operating system.
  • Provide logs (with "debug" : "..." as necessary in configuration).
  • Provide broker log excerpts.
  • Critical issue.
@cj-the-affable cj-the-affable changed the title StackOverflowException: InvalidTransactionTimeout StackOverflowException: new Error() Apr 14, 2020
@mhowlett mhowlett added bug investigate further we want to further investigate to understand properly labels Apr 14, 2020
@mhowlett
Copy link
Contributor

i took a quick look at the code and didn't see how this was possible. thanks for the code snippet - will investigate.

@midnightriot
Copy link

midnightriot commented Jun 3, 2020

@mhowlett I'm encountering this same issue when making calls to IProducer<>.SendOffsetsToTransaction() after my transaction has timed out and I get an old Epoch error right before the stack overflow.
I took a look at the code and think I have located the issue here:

private static Action<IntPtr> _error_destroy;
internal static void error_destroy(IntPtr error)
=> error_destroy(error);

error_destroy is calling itself instead of the private _error_destroy resulting in the stack overflow.

I'd be happy to put in a PR for this just let me know.

@mhowlett
Copy link
Contributor

mhowlett commented Jun 4, 2020

cool, thanks! we're doing a v1.4.4, i'll include this fix. feel free to open a pr if you want (or not, doesn't matter).

@midnightriot
Copy link

I'll leave it to you then thanks.

@mhowlett
Copy link
Contributor

resolved in 1.4.4-RC1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug investigate further we want to further investigate to understand properly
Projects
None yet
Development

No branches or pull requests

3 participants