Open kumarshantanu opened 7 years ago
I'm very low on bandwidth right now, but I did a quick look around on this and it looks like one option is handled by lein-ring and one is handled by another ring lib, so it's not surprising they're never sanity-checked against one another.
In this case I would expect the web server to abort with an error message, not due to port number collision but because the web server failed to bind server at the port.
Fair, I'll have a look at the library doing the serving and see if I can improve the error reporting.
On Mon, Dec 19, 2016 at 10:28 PM Shantanu Kumar notifications@github.com wrote:
In this case I would expect the web server to abort with an error message, not due to port number collision but because the web server failed to bind server at the port.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/weavejester/lein-ring/issues/179#issuecomment-268166052, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMv1dDloknCDFw_WabfuJZ9PhSTYug-ks5rJ3WSgaJpZM4LEPDc .
Huh, I'm confused, I see an error.
project.clj:
(defproject test-ring "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-ring "0.10.0"]]
:ring {:handler clojure.core/println
:nrepl {:start? true :port 1234}
:port 1234}
:dependencies [[org.clojure/clojure "1.8.0"]])
result:
[15:34][mike@mikepad:~/workspace/test-ring(master *)]$ lein ring server
Retrieving lein-ring/lein-ring/0.10.0/lein-ring-0.10.0.pom from clojars
Retrieving lein-ring/lein-ring/0.10.0/lein-ring-0.10.0.jar from clojars
2017-01-01 15:34:17.492:INFO::main: Logging initialized @728ms
Started nREPL server on port 1234
2017-01-01 15:34:19.630:INFO:oejs.Server:main: jetty-9.2.10.v20150310
2017-01-01 15:34:19.648:WARN:oejuc.AbstractLifeCycle:main: FAILED ServerConnector@4bbc21bd{HTTP/1.1}{0.0.0.0:1234}: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:366)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at ring.adapter.jetty$run_jetty.invokeStatic(jetty.clj:137)
at ring.adapter.jetty$run_jetty.invoke(jetty.clj:100)
at ring.server.standalone$serve$fn__2341.invoke(standalone.clj:102)
at ring.server.standalone$try_port.invokeStatic(standalone.clj:15)
at ring.server.standalone$try_port.invoke(standalone.clj:10)
at ring.server.standalone$serve.invokeStatic(standalone.clj:99)
at ring.server.standalone$serve.doInvoke(standalone.clj:75)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at ring.server.leiningen$serve.invokeStatic(leiningen.clj:13)
at ring.server.leiningen$serve.invoke(leiningen.clj:10)
at user$eval5561.invokeStatic(form-init1066665034600069929.clj:1)
at user$eval5561.invoke(form-init1066665034600069929.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
2017-01-01 15:34:19.648:WARN:oejuc.AbstractLifeCycle:main: FAILED org.eclipse.jetty.server.Server@14e3d439: java.net.BindException: Address already in use
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:366)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at ring.adapter.jetty$run_jetty.invokeStatic(jetty.clj:137)
at ring.adapter.jetty$run_jetty.invoke(jetty.clj:100)
at ring.server.standalone$serve$fn__2341.invoke(standalone.clj:102)
at ring.server.standalone$try_port.invokeStatic(standalone.clj:15)
at ring.server.standalone$try_port.invoke(standalone.clj:10)
at ring.server.standalone$serve.invokeStatic(standalone.clj:99)
at ring.server.standalone$serve.doInvoke(standalone.clj:75)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at ring.server.leiningen$serve.invokeStatic(leiningen.clj:13)
at ring.server.leiningen$serve.invoke(leiningen.clj:10)
at user$eval5561.invokeStatic(form-init1066665034600069929.clj:1)
at user$eval5561.invoke(form-init1066665034600069929.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
2017-01-01 15:34:19.650:INFO:oejs.ServerConnector:main: Stopped ServerConnector@4bbc21bd{HTTP/1.1}{0.0.0.0:1234}
Exception in thread "main" java.net.BindException: Address already in use, compiling:(/tmp/form-init1066665034600069929.clj:1:73)
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$init_opt.invokeStatic(main.clj:277)
at clojure.main$init_opt.invoke(main.clj:277)
at clojure.main$initialize.invokeStatic(main.clj:308)
at clojure.main$null_opt.invokeStatic(main.clj:342)
at clojure.main$null_opt.invoke(main.clj:339)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:321)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:366)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at ring.adapter.jetty$run_jetty.invokeStatic(jetty.clj:137)
at ring.adapter.jetty$run_jetty.invoke(jetty.clj:100)
at ring.server.standalone$serve$fn__2341.invoke(standalone.clj:102)
at ring.server.standalone$try_port.invokeStatic(standalone.clj:15)
at ring.server.standalone$try_port.invoke(standalone.clj:10)
at ring.server.standalone$serve.invokeStatic(standalone.clj:99)
at ring.server.standalone$serve.doInvoke(standalone.clj:75)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at ring.server.leiningen$serve.invokeStatic(leiningen.clj:13)
at ring.server.leiningen$serve.invoke(leiningen.clj:10)
at user$eval5561.invokeStatic(form-init1066665034600069929.clj:1)
at user$eval5561.invoke(form-init1066665034600069929.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6927)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.eval(Compiler.java:6917)
at clojure.lang.Compiler.load(Compiler.java:7379)
... 14 more
I found the error with lein-ring 0.9.7
, but I verified it occurs in 0.10.0
too. For me the error happens as I reported even when I change the port numbers to 1234
. The project.clj
is as follows:
(defproject foo "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.8.0"]
[compojure "1.5.1"]
[ring/ring-defaults "0.2.1"]]
:plugins [[lein-ring "0.10.0"]]
:ring {:handler foo.handler/app
:port 1234
:nrepl {:start? true :port 1234}}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.0"]]}})
what lein are you using?
On Sun, Jan 1, 2017 at 8:44 PM Shantanu Kumar notifications@github.com wrote:
I found the error with lein-ring 0.9.7, but I verified it occurs in 0.10.0 too. For me the error happens as I reported even when I change the port numbers to 1234. The project.clj is as follows:
(defproject foo "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.8.0"] [compojure "1.5.1"] [ring/ring-defaults "0.2.1"]] :plugins [[lein-ring "0.10.0"]] :ring {:handler foo.handler/app :port 1234 :nrepl {:start? true :port 1234}} :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring/ring-mock "0.3.0"]]}})
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/weavejester/lein-ring/issues/179#issuecomment-269934035, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMv1S5cN5En554yxo4RP4LOYM8dGzzOks5rOICcgaJpZM4LEPDc .
Lein 2.7.1
on Oracle JDK 1.8, OSX.
Tried your exact project, Leiningen 2.7.1 on Java 1.8.0_111 OpenJDK 64-Bit Server VM, Ubuntu 16.04, I get a traceback
When the nREPL port and web server port are the same, there is no error reported and the web server fails to start. Steps to reproduce the issue are below:
Edit
project.clj
as follows:Now try to start the server:
Now, connecting to nREPL server works, but the web server does not.