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

Microsoft.Garnet package: Server Initialization Fails with just --help, missing log message #817

Open
zachrybaker opened this issue Nov 21, 2024 · 1 comment · May be fixed by #820
Open
Assignees

Comments

@zachrybaker
Copy link

Describe the bug

only some options seem to boot. --port for example. But specifying others fails, in a not-helpful way.

--help, for example, will show you the help options, then crash in the constructor. It will show:
07::09::39 info: ArgParser[0] Configuration import from embedded resource succeeded. Path: defaults.conf.
Unhandled exception. Garnet.common.GarnetException: Encountered an error when initializing Garnet server. Please see log messages above for more details.
at Garnet.GarnetServer..ctor(String[] commandLineArgs, ILoggerFactory loggerFactory, Boolean cleanupDir, IAuthenticationSettings authenticationSettingsOverride)
at GarnetStart.Program.Main(String[] args) in C:\SEA\SmallProjects\Garnet\GarnetStart\GarnetStart\Program.cs:line 10
at GarnetStart.Program.

(String[] args)

We believe this issue, whatever it is, might be what is not allowing us to feed it our garnet.conf file via the option when running as service - but it may not, it's really hard to tell!

Steps to reproduce the bug

Create console .net8.0 project

add Microsoft.Garnett (any recent version, 1.0.39 for example)

change main method:

 static async Task Main(string[] args)
 {
     using var server = new Garnet.GarnetServer(args);
     server.Start();
     await Task.Delay(Timeout.Infinite);
 }

Start project (fine)
Start from command line (fine)
Start from command line with --help option (display help, then crash)

Expected behavior

show help info, then quit gracefully, or keep running.

Screenshots

07::25::05 info: ArgParser[0] Configuration import from embedded resource succeeded. Path: defaults.conf.
Unhandled exception. Garnet.common.GarnetException: Encountered an error when initializing Garnet server. Please see log messages above for more details.
at Garnet.GarnetServer..ctor(String[] commandLineArgs, ILoggerFactory loggerFactory, Boolean cleanupDir, IAuthenticationSettings authenticationSettingsOverride)
at GarnetStart.Program.Main(String[] args) in C:\SEA\SmallProjects\Garnet\GarnetStart\GarnetStart\Program.cs:line 10
at GarnetStart.Program.

(String[] args)

Release version

1.0.39

IDE

Visual Studio 2022
command line
Windows service

OS version

Windows 10
Windows server 20xx

Additional context

My end game is to get it up as a BackgroundService-ified version of the service as a windows service a la:

sc config "Famis Web PubSub" binPath="D:\AppsSvc\FamisPubSubService\FamisPubSubService.exe --config-import-path D:\AppsSvc\FamisPubSubService\garnet.conf"

seem to get more or less the same unspecified error in constructor, This does work on command line, so...odd:

FamisPubSubService.exe --config-import-path D:\AppsSvc\FamisPubSubService\garnet.conf

I think I'll be able to solve that, once the issue that prevents construction with just the --help option is sorted, and the missing log message shows up.

@TalZaccai TalZaccai self-assigned this Nov 21, 2024
@TalZaccai
Copy link
Contributor

Hi @zachrybaker! Any other issues at start up other than running with --help? Are you able to successfully start with your garnet.conf file?

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

Successfully merging a pull request may close this issue.

2 participants