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

fix: Port already Bind Error #57

Closed
wants to merge 19 commits into from
Closed

Conversation

varshith257
Copy link

@varshith257
Copy link
Author

Here's the log showcasing the starting server after CTRL+C which accumulated port bind error before,

(zulip-py3-venv) vamshi@LAPTOP-L0PR20E0:/mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice$ sbt run
[info] welcome to sbt 1.9.9 (Temurin Java 1.8.0_412)
[info] loading project definition from /mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice/projec 
[info] loading settings for project zio-quickstart-restful-webservice from build.sbt ...
[info] set current project to zio-quickstart-restful-webservice (in build file:/mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice/)
[info] running dev.zio.quickstart.MainApp
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
timestamp=2024-08-18T00:58:12.680Z level=INFO thread=#zio-fiber-5 message="Starting the server..." location=dev.zio.quickstart.MainApp.run file=MainApp.scala line=20
timestamp=2024-08-18T00:58:12.702Z level=INFO thread=#zio-fiber-5 message="Server started" location=dev.zio.quickstart.MainApp.run file=MainApp.scala line=20
^C
[warn] Canceling execution...
Cancelled: run
[error] Cancelled: run
[error] Use 'last' for the full log.
Exception in thread "sbt-bg-threads-1" java.lang.Error: java.lang.InterruptedException
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1155)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.InterruptedException
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Object.java:502)
        at zio.internal.OneShot.get(OneShot.scala:83)
        at zio.Runtime$UnsafeAPIV1.run(Runtime.scala:139)
        at zio.ZIOAppPlatformSpecific.main(ZIOAppPlatformSpecific.scala:60)
        at zio.ZIOAppPlatformSpecific.main$(ZIOAppPlatformSpecific.scala:6)
        at dev.zio.quickstart.MainApp$.main(MainApp.scala:14)
        at dev.zio.quickstart.MainApp.main(MainApp.scala)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sbt.Run.invokeMain(Run.scala:144)
        at sbt.Run.execute$1(Run.scala:94)
        at sbt.Run.$anonfun$runWithLoader$5(Run.scala:121)
        at sbt.Run$.executeSuccess(Run.scala:187)
        at sbt.Run.runWithLoader(Run.scala:121)
        at sbt.Defaults$.$anonfun$bgRunTask$6(Defaults.scala:1988)
        at sbt.Defaults$.$anonfun$termWrapper$2(Defaults.scala:1927)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at scala.util.Try$.apply(Try.scala:213)
        at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:367)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        ... 2 more
(zulip-py3-venv) vamshi@LAPTOP-L0PR20E0:/mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice$ sbt run
[info] welcome to sbt 1.9.9 (Temurin Java 1.8.0_412)
[info] loading project definition from /mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice/projec 
[info] loading settings for project zio-quickstart-restful-webservice from build.sbt ...
[info] set current project to zio-quickstart-restful-webservice (in build file:/mnt/c/Users/91970/Desktop/zio-quickstarts/zio-quickstart-restful-webservice/)
[info] running dev.zio.quickstart.MainApp
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
timestamp=2024-08-18T00:58:51.939Z level=INFO thread=#zio-fiber-5 message="Starting the server..." location=dev.zio.quickstart.MainApp.run file=MainApp.scala line=20
timestamp=2024-08-18T00:58:51.952Z level=INFO thread=#zio-fiber-5 message="Server started" location=dev.zio.quickstart.MainApp.run file=MainApp.scala line=20

Copy link
Member

@guizmaii guizmaii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree with this change. This introduces code to solve a dev mode problem which doesn't exist in prod mode and which doesn't exist when a project is correctly configured and run (aka sbt-revolver configured and used to run the project. See zio-http doc: https://zio.dev/zio-http/installation#hot-reload-changes-watch-mode

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