zio / zio-http

A next-generation Scala framework for building scalable, correct, and efficient HTTP clients and servers
https://zio.dev/zio-http
Apache License 2.0
787 stars 396 forks source link

[Port already bound Error] In the example `zio-quickstart-restful-webservice`, Pressing Ctrl-C blocks the port 8080 #2776

Closed vivasvan1 closed 3 months ago

vivasvan1 commented 5 months ago

Describe the bug In the example zio-quickstart-restful-webservice, Running sbt, then run and Pressing Ctrl-C blocks the port 8080

To Reproduce Steps to reproduce the behaviour:

  1. Go to 'zio-quickstart-restful-webservice' repo
  2. Run sbt
  3. Type run and press enter
  4. Press Ctrl+C
  5. Now type run again and press enter
  6. See the Error.

Expected behaviour Server.serve should be able to handle interuptions (like Ctrl+C)

Screenshots image

Desktop (please complete the following information):

Additional context n/a

jdegoes commented 4 months ago

/bounty $150

algora-pbc[bot] commented 4 months ago

💎 $150 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #2776 with your implementation plan
  2. Submit work: Create a pull request including /claim #2776 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/zio-http!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟡 @varshith257 Jun 22, 2024, 6:11:25 PM #58
kyri-petrou commented 4 months ago

@jdegoes @vivasvan1 AFAICT this is the intended behaviour, and it's not related to zio-http but with zio (see here).

The workaround is to add run / fork := true in the build.sbt file so that the server is shut down

varshith257 commented 3 months ago

/attempt #2776

kyri-petrou commented 3 months ago

I'm closing this issue since it's not related to zio-http, although it'd be good if someone can create a PR in the zio-quickstart-restful-webservice repo as per my comment above

algora-pbc[bot] commented 3 months ago

@varshith257: Reminder that in 7 days the bounty will become up for grabs, so please submit a pull request before then 🙏

algora-pbc[bot] commented 3 weeks ago

💡 @varshith257 submitted a pull request that claims the bounty. You can visit your bounty board to reward.