Can't get hostname on WSL2+docker host network
See original GitHub issueHi, this is a rather obscure bug 🙂
When running Quartz using the SimpleInstanceIdGenerator on WSL2 + docker + host network, it fails to get the current hostname and crashes when initializing the scheduler factory.
I’ve created a repro in https://github.com/mausch/QuartzNetHostAddressTest
The exception is “Cannot run without an instance id.” thrown at https://github.com/quartznet/quartznet/blob/a22915a9abac1568accb93eb24b4cce5331c8249/src/Quartz/Impl/StdSchedulerFactory.cs#L930 .
BTW it seems that throw should carry the inner exception i.e. make it:
throw new InvalidOperationException("Cannot run without an instance id.", e);
The way I propose to fix this is to simplify https://github.com/quartznet/quartznet/blob/2fccbc1a17c3fc1bd6f7433f8aedc2c541a1fa46/src/Quartz/Simpl/HostNameBasedIdGenerator.cs#L61-L62
Not sure why it’s doing all that DNS resolution just to get the hostname? Couldn’t that be just a call to Dns.GetHostName()
? I looked through the history of that file but couldn’t figure out why, maybe someone else knows!
Many thanks, Mauricio
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
3.3.2 should be available on NuGet now, thanks for the report and past contributions!
I’m hoping to get 3.3.2 out this evening so I went ahead 😉