question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ember client doesn't shut down quickly when cancelled

See original GitHub issue

To replicate, set fork := true, in your SBT config and compile the following:

import cats.data.Kleisli
import cats.effect.kernel.Resource
import cats.effect.{ExitCode, IO, IOApp}
import org.http4s.ember.server.EmberServerBuilder
import org.http4s.ember.client.EmberClientBuilder
import org.http4s.implicits.http4sLiteralsSyntax
import com.comcast.ip4s._

object TestEmberClientHang extends IOApp.Simple {
  def run: IO[Unit] = EmberClientBuilder.default[IO].build.use(_.statusFromUri(uri"http://localhost:8765")).void
}

object RunServer extends IOApp.Simple {
  def run: IO[Unit] =
    EmberServerBuilder.default[IO].withPort(port"8765").withHttpApp(Kleisli(_ => IO.never)).build.useForever
}
  1. Run runMain RunServer
  2. In a different SBT session, run runMain TestEmberClientHang
  3. Hit ctrl+c in the second SBT session (with TestEmberClientHang)

Expected: the TestEmberClientHang process terminates immediately, like the version using the blaze client does. Actual: the TestEmberClientHang process continues to run for > 30 seconds

Tested on macOS 12.0.1 (21A559)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:32 (20 by maintainers)

github_iconTop GitHub Comments

2reactions
stephenjudkinscommented, Mar 4, 2022

I can confirm that this fixes it for me!

FWIW, the nc version of the test doesn’t work and I had to do brew install netcat on macOS to get both the fixed and unfixed versions working as expected without throwing exceptions.

I’d like to express my gratitude for everyone who worked hard to reproduce/investigate/fix this issue

1reaction
stephenjudkinscommented, Mar 1, 2022

I think this might be possible to reproduce in a pure-scala context without any processes or signals, I might take a crack of that if I get a minute

Read more comments on GitHub >

github_iconTop Results From Across the Web

ember-server hanging on cancellation · Issue #6420 - GitHub
I extracted the test into a scala-cli runnable IOApp and did a ... Ember client doesn't shut down quickly when cancelled #6058 (comment)....
Read more >
HTTP Client - http4s
Unlike the ember client, it does not need to be shut down. Like the ember-client, and any other http4s backend, it presents the...
Read more >
Adopting ember-concurrency - LinkedIn Engineering
Automatically cancel tasks that are bound to a component: no need for the willDestroyElement hook—it is safe to assume that the UI code...
Read more >
Ember FAQs - Comparably
If your Ember continues to disconnect or is unable to reconnect with your mobile device, there are a few quick steps that can...
Read more >
Google's constant product shutdowns are damaging its brand
If we just take the official shutdown dates that have already occurred in 2019, a Google-branded product, feature, or service has died, on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found