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

Weird MongoDB error when running the rest-fights service with Quarkus dev #752

Closed
ingmarfjolla opened this issue Mar 13, 2024 · 8 comments
Closed
Labels
bug Something isn't working

Comments

@ingmarfjolla
Copy link
Collaborator

Describe the bug
hello!

When I try to run the rest-fights service with ./mvnw quarkus:dev I get a stack trace like this:


18:11:45 INFO  [or.mo.dr.cluster] (cluster-ClusterId{value='65f224a1141b7478a47c5e8f', description='null'}-mongo-yexv5:27017) Exception in monitor thread while connecting to server mongo-yexv5:27017: com.mongodb.MongoSocketException: mongo-yexv5: nodename nor servname provided, or not known
	at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:221)
	at com.mongodb.internal.connection.ServerAddressWithResolver.getSocketAddresses(ServerAddressWithResolver.java:68)
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:100)
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:78)
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:211)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:196)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:156)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.UnknownHostException: mongo-yexv5: nodename nor servname provided, or not known
	at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:934)
	at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1543)
	at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1533)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1385)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
	at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:213)
	... 7 more


18:11:45 INFO  [or.mo.dr.cluster] (Quarkus Main Thread) No server chosen by ReadPreferenceServerSelector{readPreference=primary} from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=mongo-yexv5:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketException: mongo-yexv5: nodename nor servname provided, or not known}, caused by {java.net.UnknownHostException: mongo-yexv5: nodename nor servname provided, or not known}}]}. Waiting for 30000 ms before timing out
18:11:45 INFO  [or.mo.dr.cluster] (cluster-ClusterId{value='65f224a1141b7478a47c5e8f', description='null'}-mongo-yexv5:27017) Exception in monitor thread while connecting to server mongo-yexv5:27017: com.mongodb.MongoSocketException: mongo-yexv5
	at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:221)
	at com.mongodb.internal.connection.ServerAddressWithResolver.getSocketAddresses(ServerAddressWithResolver.java:68)
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:100)
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:78)
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:211)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:196)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:156)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.UnknownHostException: mongo-yexv5
	at java.base/java.net.InetAddress$CachedAddresses.get(InetAddress.java:801)
	at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1533)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1385)
	at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1306)
	at com.mongodb.ServerAddress.getSocketAddresses(ServerAddress.java:213)
	... 7 more

Now, I noticed that if I manually start a mongoDB container (and then also provide the mongoDB connection string, user, password in an app properties) that error goes away and it seems to be working.

But, when I try to initiate a fight I get a super similar error for kafka:

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.net.UnknownHostException: kafka-c2mfg: nodename nor servname provided, or not known

To Reproduce
Steps to reproduce the behavior:

  1. start the downstream services with this command : docker compose -f rest-heroes/deploy/docker-compose/java17.yml -f rest-villains/deploy/docker-compose/java17.yml -f rest-narration/deploy/docker-compose/java17.yml -f grpc-locations/deploy/docker-compose/java17.yml up --remove-orphans
  2. Start the rest-fights service with ./mvnw quarkus:dev
  3. See error

Expected behavior
Starting with no issues, unless I missed something in the docs

Desktop (please complete the following information):

  • OS: Apple M1 Mac OS Sonoma 14.3.1
  • Browser: Firefox/Chrome
  • Version: openjdk 17.0.8.1 2023-08-24

Let me know if you need more info, or if I just completely missed something in the docs! Thanks

@ingmarfjolla ingmarfjolla added the bug Something isn't working label Mar 13, 2024
@edeandrea
Copy link
Collaborator

edeandrea commented Mar 13, 2024

Yeah this is known and is due to microcks/microcks-quarkus#30

You can get it to work by not using Microcks by following https://github.com/quarkusio/quarkus-super-heroes/tree/main/rest-fights#integration-with-microcks

(i.e. ./mvnw quarkus:dev -Dquarkus.profile=no-microcks)

@ingmarfjolla
Copy link
Collaborator Author

ah I didn't see that issue, thank you so much!

@ingmarfjolla
Copy link
Collaborator Author

Do you happen to know if getting an issue in the frontend like this with Quarkus dev:

ERROR
Request failed with status code 404
AxiosError@http://localhost:3000/static/js/bundle.js:59623:18
settle@http://localhost:3000/static/js/bundle.js:60276:12
onloadend@http://localhost:3000/static/js/bundle.js:58938:66
ERROR
Request failed with status code 404
AxiosError@http://localhost:3000/static/js/bundle.js:59623:18
settle@http://localhost:3000/static/js/bundle.js:60276:12
onloadend@http://localhost:3000/static/js/bundle.js:58938:66

is related to the issue? I started the frontend with the same ./mvnw quarkus:dev -Dquarkus.profile=no-microcks but on localhost:3000 I keep getting that error (with or without the added profile). Though interestingly if I go to localhost:8080 it works fine so maybe I did something else wrong

@edeandrea
Copy link
Collaborator

Yeah port 8080 is the correct port, not 3000. It's a quarkus app.

@holly-cummins
Copy link
Collaborator

Yeah port 8080 is the correct port, not 3000. It's a quarkus app.

@ingmarfjolla, to add a bit more context to what you're seeing, a Quarkus extension called Quinoa is handling the integration between the front and back ends. Under the covers, it starts the javascript live coding server on port 3000, and then it proxies requests to it. But if you access things directly on 3000, they won't have the right back end services because you're only seeing the thin front-end layer. https://quarkus.io/blog/quinoa-modern-ui-with-no-hassle/ explains a bit more about Quinoa.

@ingmarfjolla
Copy link
Collaborator Author

@holly-cummins thanks for the added context!

@edeandrea
Copy link
Collaborator

@ingmarfjolla am I ok to close out this issue?

@ingmarfjolla
Copy link
Collaborator Author

@edeandrea yep, sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants