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.

The console application does not terminate after a successful request

See original GitHub issue

I developing console application on Kotlin. If I make a request from the main thread and request finishes (successful or not, doesn’t matter) application won’t close for a minute. Is that normal behavior? Is there a way to stop execution right after result handler finishes its execution?

Request:

Fuel.get("/info").responseString { _, _, result ->
        when (result) {
            is Result.Failure -> {
                println("Failure")
            }
            is Result.Success -> {
                println("Success")
            }
        }
    }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
yoavstcommented, Aug 22, 2017

Fuel opens a daemon thread that prevents the JVM from shutdown. You can try this code to shutdown Fuel, though it should probably provide a better masochism for that:

FuelManager.executor.shutdownNow()

Is someone familiar with how OKHttp handles that?

1reaction
sosodevcommented, Jul 15, 2017

Just noticed the same problem. I’m guessing it’s a problem with the jvm waiting for the async thread to officially close, because if you use the non-async version it terminates immediately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# console application does not terminate in command ...
I have developed a console application in c#. When I invoke developed command in command window and minimise it to work on other...
Read more >
Terminating a c# Console application - Stack Overflow
If you are starting console application from Visual Studio not in debug mode (Ctrl+F5), then console window stays open after application finished execution....
Read more >
How to terminate a .NET console application with an exit code
It happens that you'd like to terminate a .NET console application with some exit code. Normally exit codes are integers where negative ...
Read more >
Gracefully terminate a threaded C# console application on ...
So, most console applications seemingly terminate instantly when they receive a CTRL+C , but occasionally you may notice that some have a ...
Read more >
Terminate your instance - Amazon Elastic Compute Cloud
Instance termination. After you terminate an instance, it remains visible in the console for a short while, and then the entry is automatically...
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