question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't get hostname on WSL2+docker host network

See original GitHub issue

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 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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lahmacommented, Apr 9, 2021

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

0reactions
lahmacommented, Apr 9, 2021

I’m hoping to get 3.3.2 out this evening so I went ahead 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Networking problems with WSL2 and Docker Desktop for ...
Normally, I can access a port started from a WSL2 instance ("distribution" in WSL2-speak) from inside Docker containers, by finding the IP ......
Read more >
How to access service running on host from WSL2 ...
Obtain the IP address of your host machine by running this command from your Linux distribution: cat /etc/resolv.conf Copy the IP address ......
Read more >
Not able to ping Windows Host from WSL2
You are attempting to use a network name that is specific to Docker Desktop. Do not use this name when not working with...
Read more >
Accessing network applications with WSL
Obtain the IP address of your host machine by running this command ... Accessing a WSL 2 distribution from your local area network...
Read more >
How to connect to the Docker host from inside a ...
As of Docker version 18.03, you can use the host.docker.internal hostname to connect to your Docker host from inside a Docker container. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found