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

Handle exception from Web server startup #1790

Open
Ashish123gs opened this issue Feb 23, 2022 · 1 comment
Open

Handle exception from Web server startup #1790

Ashish123gs opened this issue Feb 23, 2022 · 1 comment

Comments

@Ashish123gs
Copy link

I noticed that we don't handle the error thrown from Web server startup.
One of the common problem can be the 'port in use' when Web server starts up.

The cruise control app will start and continue to run but the http API will be inaccessible.
This can be misleading and can cause problems when we run multiple daemons on same host.
someone can accidently use a different http api.

ex error -

//..//

[2022-02-22 15:04:16,091] ERROR Uncaught exception on thread Thread[main,5,main] (com.linkedin.kafka.cruisecontrol.KafkaCruiseControlMain)
java.io.IOException: Failed to bind to /myServer:myPort
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.server.Server.doStart(Server.java:401) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73) ~[jetty-util-9.4.42.v20210604.jar:9.4.42.v20210604]
at com.linkedin.kafka.cruisecontrol.KafkaCruiseControlApp.start(KafkaCruiseControlApp.java:66) ~[cruise-control.jar:?]
at com.linkedin.kafka.cruisecontrol.KafkaCruiseControlMain.main(KafkaCruiseControlMain.java:40) ~[cruise-control.jar:?]
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_202]
at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_202]
at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_202]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:1.8.0_202]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[?:1.8.0_202]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.42.v20210604.jar:9.4.42.v20210604]
... 8 more

//..//

@Ashish123gs
Copy link
Author

may be we handle the error in KafkaCruiseControlApp.java

line 66

void start() throws Exception {
_kafkaCruiseControl.startUp();
try{
_server.start();
} catch ( Exception e)
{
"failed to start server..exiting now"
System.exit(1);
}
printStartupInfo();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant