thatdot / quine

Quine • a streaming graph • https://quine.io • Discord: https://discord.gg/GMhd8TE4MR
https://quine.io
Other
295 stars 39 forks source link

Overriding Default Port #7

Closed hnashif closed 2 years ago

hnashif commented 2 years ago

The default port of 8080 is already in use on my machine and Quine was unable to bind to 8080. Running Quine w/ -h displays -p, --port command line option to override the default port. This was validated by running a recipe as shown below:

% java -jar quine-1.1.0.jar -r apache_log --recipe-value in_file=/var/log/apache2/access.log.1 -p 8081
16:10:48,465 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:10:48,465 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.xml]
16:10:48,647 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestampedNoDrop] - Attaching appender named [consoleTimestamped] to AsyncAppender.
16:10:48,648 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestampedNoDrop] - Setting discardingThreshold to 0
16:10:48,650 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncConsole] - Attaching appender named [console] to AsyncAppender.
16:10:48,650 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncConsole] - Setting discardingThreshold to 51
16:10:48,651 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestamped] - Attaching appender named [consoleTimestamped] to AsyncAppender.
16:10:48,651 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestamped] - Setting discardingThreshold to 0
16:10:48,663 |-WARN in org.gnieh.logback.config.ConfigConfigurator@6a4d7f76 - No configuration files to watch, so no file scanning is possible

Graph is ready!
Application state loaded.
Running Recipe Apache Log Analytics
Using 1 sample queries
Running Standing Query STANDING-1
2022-03-15 16:10:51,827 WARN [NotFromActor] [graph-service-akka.quine.graph-shard-dispatcher-16] com.thatdot.quine.app.importers.package$ - Could not verify that the provided ingest query is idempotent. If timeouts occur, query
execution may be retried and duplicate data may be created.
Running Ingest Stream INGEST-1
Status query URL is
http://0.0.0.0:8081#MATCH%20%28l%29%2D%5Brel%3Averb%5D%2D%3E%28v%29%20WHERE%20l%2Etype%20%3D%20%27log%27%20AND%20v%2Etype%20%3D%20%27verb%27%20AND%20v%2Everb%20%3D%20%27GET%27%20RETURN%20count%28rel%29%20AS%20get%5Fcount
Quine app web server available at http://0.0.0.0:8081
INGEST-1 status is completed and ingested 12
---[ Status Q
get_count | 2G-1 count 12

However, when Quine is started w/ -p option set to 8081, but w/o a recipe, it ignores the -p arg and defaults to 8080. On my machine, this failed to bind to 8080 as it is in use:

% java -jar quine-1.1.0.jar -p 8081
16:09:29,796 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:09:29,797 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.xml]
16:09:30,012 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestampedNoDrop] - Attaching appender named [consoleTimestamped] to AsyncAppender.
16:09:30,012 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestampedNoDrop] - Setting discardingThreshold to 0
16:09:30,015 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncConsole] - Attaching appender named [console] to AsyncAppender.
16:09:30,015 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncConsole] - Setting discardingThreshold to 51
16:09:30,015 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestamped] - Attaching appender named [consoleTimestamped] to AsyncAppender.
16:09:30,015 |-INFO in ch.qos.logback.classic.AsyncAppender[asyncTimestamped] - Setting discardingThreshold to 0
16:09:30,028 |-WARN in org.gnieh.logback.config.ConfigConfigurator@72bc6553 - No configuration files to watch, so no file scanning is possible

Graph is ready!
Application state loaded.
2022-03-15 16:09:34,099 ERROR [akka://graph-service/system/IO-TCP/selectors/$a/0] [graph-service-akka.actor.default-dispatcher-4] akka.io.TcpListener - Bind failed for TCP channel on endpoint [/0.0.0.0:8080]
java.net.BindException: [/0.0.0.0:8080] Address already in use
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:455)
    at java.base/sun.nio.ch.Net.bind(Net.java:447)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
    at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80)
    at akka.io.TcpListener.liftedTree1$1(TcpListener.scala:60)
    at akka.io.TcpListener.<init>(TcpListener.scala:57)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at akka.util.Reflect$.instantiate(Reflect.scala:73)
    at akka.actor.ArgsReflectConstructor.produce(IndirectActorProducer.scala:101)
    at akka.actor.Props.newActor(Props.scala:226)
    at akka.actor.ActorCell.newActor(ActorCell.scala:616)
    at akka.actor.ActorCell.create(ActorCell.scala:643)
    at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:514)
    at akka.actor.ActorCell.systemInvoke(ActorCell.scala:536)
    at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:295)
    at akka.dispatch.Mailbox.run(Mailbox.scala:230)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
landon9720 commented 2 years ago

Hi @hnashif ; thank you for reporting this issue.

The -p command line option is only for overriding the port when running a Recipe. As a work-around, to override the port when not running a Recipe, specify these command line options as follows:

java -Dquine.webserver.address=localhost -Dquine.webserver.port=8081 -jar quine.jar

Obviously this is a confusing situation, we will improve this in the future.

Finally, here's a reminder to join our Slack community.

emanb29 commented 2 years ago

https://github.com/thatdot/quine/releases/tag/v1.2.1 includes https://github.com/thatdot/quine/commit/ca04d84556cacf1a41063e36b56fa012e93c6d34 which adds extended support for command-line arguments, including -p, allowing them to be used with the main Quine application