twitter-archive / diffy

Find potential bugs in your services with Diffy
https://twitter.com/diffyproject
Apache License 2.0
3.83k stars 368 forks source link

You must specify host and port #62

Closed LimpanB closed 6 years ago

LimpanB commented 6 years ago

First of all, im not that used to coding so this is a little bit out of my league. But i figured i might try and learn and this is probably just be a user error but been trying to google an aswer all day now without going forward.

This is my example.sh file: #!/usr/bin/env bash java -jar ./target/scala-2.11/diffy-server.jar \ -candidate='http://enviromentname.test.companyname.com:80' \ -master.primary='http://prod-companyname.com:80' \ -master.secondary='http://prod-companyname.com:80' \ -service.protocol='http' \ -serviceName='My Service' \ -proxy.port=:31900 \ -admin.port=:31159 \ -http.port=:31149 \ -rootUrl='localhost:31149'

Im able to start it and i can go to the diffy localhost:31149 page. But whenever i try to run a request to http://localhost:31149/foo/bar/all?departureDate=2017-11-24 it returns blank and i cant see anything happen in Diffy.

Checking the command promt it seems to be complaining about my host and port?

I 1006 13:50:38.098 THREAD1: candidate resolved to Failed(java.lang.IllegalArgum entException: requirement failed: You must specify host and port) I 1006 13:50:38.099 THREAD1: primary resolved to Failed(java.lang.IllegalArgumen tException: requirement failed: You must specify host and port) I 1006 13:50:38.099 THREAD1: secondary resolved to Failed(java.lang.IllegalArgum entException: requirement failed: You must specify host and port) I 1006 13:50:38.153 THREAD1: Scheduling com.twitter.diffy.workflow.FunctionalRep ort at 2017-10-06 13:50:38 +0000

puneetkhanduri commented 6 years ago

In your example try http://localhost: 31900/foo/bar/all?departureDate=2017-11-24 and then look at localhost:31149

LimpanB commented 6 years ago

Im sorry my bad, tired friday afternoon. I am using http://localhost:31900/foo/bar/all?departureDate=2017-11-24 And all im getting is a blank page, whenever i run the example.sh. Figured out the "You must specify host and port" problem. It didnt allow me to use http://. But now im still just getting a blank page/nothing return when i curl.

leenasn commented 6 years ago

I am getting this error when I use a non-localhost URL. The command I tried is as follows:

java -jar diffy-server.jar \
-candidate=localhost:3000 \
-master.primary='http://<URLinheroku>' \
-master.secondary='http://<URLinheroku> \
-service.protocol=http \
-serviceName=MyService \
-proxy.port=:31900 \
-admin.port=:31159 \
-http.port=:31149 \
-rootUrl='localhost:31149'

Am I doing anything wrong? Or is it that it can run only against localhost? But I saw that #53 its mentioned that you can run this against any host.

The stacktrack is as follows:

java.lang.NumberFormatException: For input string: "//blacklotus-staging.herokuapp.com"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:569)
    at java.lang.Integer.parseInt(Integer.java:615)
    at scala.collection.immutable.StringLike$class.toInt(StringLike.scala:272)
    at scala.collection.immutable.StringOps.toInt(StringOps.scala:30)
    at com.twitter.finagle.util.InetSocketAddressUtil$$anonfun$parseHostPorts$3.apply(InetSocketAddressUtil.scala:44)
    at com.twitter.finagle.util.InetSocketAddressUtil$$anonfun$parseHostPorts$3.apply(InetSocketAddressUtil.scala:40)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)

I tried passing the port as 80 and got the same error.

The error went when I passed the URL by removing http://, but the tests are failing because it doesn't seem to be sending the requests to the right URL. I am getting the error as /www.herokucdn.com/error-pages/no-such-app.html.

Can you help me fix this? Thanks.

puneetkhanduri commented 6 years ago

@leenasn I have had similar problems when resolving herokuapp.com subdomains. Unfortunately, I am not sure how to address that. The canonical address format used by diffy is something like mystagingdomain.com:80 but I don't think that solves your problem because you are using heroku subdomains. Sorry couldn't be of more help.

@mosesn Any thoughts on how to get finagle to resolve a subdomain like "blacklotus-staging.herokuapp.com"?

mosesn commented 6 years ago

Regarding the URL, I don't know exactly how you are using this inside of finagle, but it sounds like you're using it for the host header and the dest string. Neither of these should include the http:// scheme. When I go to blacklotus-staging.herokuapp.com in my web browser, it seems to not exist. Is there another app I can try out?

puneetkhanduri commented 6 years ago

This is being used as a destination string to initialize a finagle http client.

It's passed as the server argument to this method: https://github.com/twitter/diffy/blob/master/src/main/scala/com/twitter/diffy/proxy/HttpDifferenceProxy.scala#L37

puneetkhanduri commented 6 years ago

I remember trying something like "blacklotus-staging.herokuapp.com:80" (without http://) but it didn't seem to resolve properly.

mosesn commented 6 years ago

@puneetkhanduri that url doesn't seem to be good. Do you have another example?

puneetkhanduri commented 6 years ago

moviehopper.herokuapp.com

sarath21 commented 6 years ago

@puneetkhanduri I have similar issue. I have non-localhost machine. Getting the following error.

$ java -jar target/scala-2.11/diffy-server.jar -candidate=<hostname-without-http>:80 -master.primary=<hostname-without-http>:80 -master.secondary=<hostname-without-http>:80 -service.protocol=http -serviceName=VMS-Service -proxy.port=:8880 -admin.port=:8881 -http.port=:8888 -rootUrl='localhost:8888'

On making curl request, I'm getting the following error.

I 0424 21:08:49.879 THREAD1: Scheduling com.twitter.diffy.workflow.FunctionalReport at 2018-04-24 21:08:49 +0000 D 0424 21:09:12.917 THREAD26: success networking D 0424 21:09:12.917 THREAD26: error lifting com.twitter.finagle.NoBrokersAvailableException: No hosts are available for secondary, Dtab.base=[], Dtab.local=[] at com.twitter.finagle.NoStacktrace(Unknown Source)

Without port, I'm getting for primary, secondary, candidate hosts.

I 0424 21:17:18.219 THREAD1: secondary: name resolution failed java.lang.IllegalArgumentException: requirement failed: You must specify host and port at scala.Predef$.require(Predef.scala:219) at com.twitter.finagle.util.InetSocketAddressUtil$$anonfun$parseHostPorts$3.apply(InetSocketAddressUtil.scala:41) at com.twitter.finagle.util.InetSocketAddressUtil$$anonfun$parseHostPorts$3.apply(InetSocketAddressUtil.scala:40)

I'm using diffy-server latest clone assembly.