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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get hostname on WSL2+docker host network #1158

Closed
mausch opened this issue Apr 8, 2021 · 5 comments 路 Fixed by #1160
Closed

Can't get hostname on WSL2+docker host network #1158

mausch opened this issue Apr 8, 2021 · 5 comments 路 Fixed by #1160
Milestone

Comments

@mausch
Copy link
Contributor

mausch commented Apr 8, 2021

Hi, 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

throw new InvalidOperationException("Cannot run without an instance id.");
.

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

var hostAddress = await GetHostAddress(cancellationToken).ConfigureAwait(false);
string hostName = hostAddress.HostName;

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

@lahma
Copy link
Member

lahma commented Apr 8, 2021

Thanks for reporting the issue! Neither do I remember the original idea behind the name resolution. We can probably change this like you suggested and see if we break some other obscure use case 馃槈

Would you like to offer a PR?

@lahma
Copy link
Member

lahma commented Apr 9, 2021

Created #1160 to address the issue, in my tests it works now.

@mausch
Copy link
Contributor Author

mausch commented Apr 9, 2021

Great thanks! I was going to submit a PR tonight, you beat me to it 馃檪 馃殌

@lahma
Copy link
Member

lahma commented Apr 9, 2021

I'm hoping to get 3.3.2 out this evening so I went ahead 馃槈

@lahma
Copy link
Member

lahma commented Apr 9, 2021

3.3.2 should be available on NuGet now, thanks for the report and past contributions!

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