Skip to content
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

Got into "System.ArgumentException: The initial count cannot be greater than 32767." while bytesCapacity in options is not #19

Open
ColourfulBlack opened this issue May 8, 2023 · 0 comments

Comments

@ColourfulBlack
Copy link

Problem description

At first, I import Cloudtoid.Interprocess to my ASP.NET WEB API backend application, every time it run using var publisher = factory.CreatePublisher(options); it got into the exception below:

Unhandled exception. System.ArgumentException: The initial count cannot be greater than 32767. (Parameter 'initialCount')
   at Cloudtoid.Interprocess.Semaphore.MacOS.Interop.CreateOrOpenSemaphore(String name, UInt32 initialCount)
   at Cloudtoid.Interprocess.Semaphore.MacOS.SemaphoreMacOS..ctor(String name, Boolean deleteOnDispose)
   at Cloudtoid.Interprocess.InterprocessSemaphore.CreateReleaser(String name)
   at Cloudtoid.Interprocess.Publisher..ctor(QueueOptions options, ILoggerFactory loggerFactory)
   at Cloudtoid.Interprocess.QueueFactory.CreatePublisher(QueueOptions options)
   ...

I move the code into a vary simple project which just contains a single Program.cs:

using Cloudtoid.Interprocess;
using Microsoft.Extensions.Logging;

var factory = new QueueFactory();
var options = new QueueOptions(
    queueName: "sample-queue", bytesCapacity: 24);// just 24
using var publisher = factory.CreatePublisher(options);

It got into the same exception.

Reproduction

I pushed that simple project to this GitHub repository

Additional information

Cloudtoid.Interprocess version 1.0.175

My OS information:

# uname -a
Darwin hostname.lan 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar  6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64

My dotnet information:

# dotnet --info
.NET SDK:
 Version:   7.0.203
 Commit:    5b005c19f5

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.3
 OS Platform: Darwin
 RID:         osx.13-arm64
 Base Path:   /usr/local/share/dotnet/sdk/7.0.203/

Host:
  Version:      7.0.5
  Architecture: arm64
  Commit:       8042d61b17

.NET SDKs installed:
  7.0.203 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/opt/homebrew/opt/dotnet/libexec]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant