0

我正在使用 java sdk:

compile(group: 'com.azure',  name: 'azure-cosmos', version: '4.8.0')

在天蓝色的功能。不知道上面的错误是从哪里来的:

您正在创建太多 HashedWheelTimer 实例。HashedWheelTimer 是一个共享资源,必须在 JVM 中重复使用,因此只创建了几个实例。

4

1 回答 1

0

看,这不是您期望的完整答案-这是尝试提供帮助,也许它会给您提供任何想法,以解决这个非常罕见的错误。

我认为这部分有一个错误:报告ReportTooManyInstances https://github.com/Azure/DotNetty/blob/4a76e624580e0005257513fce1c69555294763f5/src/DotNetty.Common/Utilities/HashedWheelTimer.cs#L257-L258

  static void ReportTooManyInstances() =>
        Logger.Error($"You are creating too many {nameof(HashedWheelTimer)} instances. 
  {nameof(HashedWheelTimer)} is a shared resource that must be reused across the process,so that only a few instances are created.");

InstanceCountLimit = 64乞讨中 有一个硬代码: https ://github.com/Azure/DotNetty/blob/4a76e624580e0005257513fce1c69555294763f5/src/DotNetty.Common/Utilities/HashedWheelTimer.cs#L19-L27

    public sealed class HashedWheelTimer : ITimer
    {
        static readonly IInternalLogger Logger =
            InternalLoggerFactory.GetInstance<HashedWheelTimer>();

        static int instanceCounter;
        static int warnedTooManyInstances;

        const int InstanceCountLimit = 64;

如果你到达InstanceCountLimit,有一段代码说明ReportTooManyInstances应该抛出。

https://github.com/Azure/DotNetty/blob/4a76e624580e0005257513fce1c69555294763f5/src/DotNetty.Common/Utilities/HashedWheelTimer.cs#L105-L108

            if (Interlocked.Increment(ref instanceCounter) > InstanceCountLimit &&
                Interlocked.CompareExchange(ref warnedTooManyInstances, 1, 0) == 0)
            {
                ReportTooManyInstances();
            }

我还发现了什么(也许你会感兴趣):

Functions 最佳实践:优化 Azure Functions 的性能和可靠性

于 2021-01-26T12:26:50.107 回答