Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6074035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:20:14+00:00 2026-05-23T10:20:14+00:00

We have a (very) multithreaded application that would pass all unit tests, but would

  • 0

We have a (very) multithreaded application that would pass all unit tests, but would not exit when run from the IDE or command line. This app is not only multi-threaded, it executes native processes, and writes to standard error and standard out.
The problem was that the app would hang on exit. Eventually, I reduced the app until it was identical to the unit tests, and it would still hang, so, I figured that JUnit was doing something that a command-line launch was not.
When I called System.exit() at the end of main(args), the app would exit, which finally lead me to System.err.close().
Of course, the app never “opens” System.err or System.out. It just writes to them, and calls flush() when finished. I’ve only tested on 64 bit Windows, I’ll test later on Linux. The JVM is Java(TM) SE Runtime Environment (build 1.6.0_24-b07)

Any ideas why the JVM won’t exit?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:20:15+00:00Added an answer on May 23, 2026 at 10:20 am

    All programs on Linux face this problem to some extent. A process with an open filehandle (and you obviously have one, even though you didn’t specifically open one, it came from one of your system command operations) won’t fully exit until all the handles are closed. The best example I can think of at the moment is a problem I had at work where a startup script (bash) which starte a java process never exited. The problem was, we were doing 2>&1 > /path/to/log & which doesn’t close stdin (file handle 0). Chainging it to &> /path/to/log fixed the problem, because &> means all filehandles, while the other just meant stdin and stderr.

    Your problem is similar, and the fact that it is multithreaded exacerbates the issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very large code base that contains extensive unit tests (using CppUnit).
Scenario I have a very heavy number-crunching process that pools large datasets from 3
I have a windows service that is very heavily multithreaded (hundreds to thousands at
I have a multithreaded WPF application that is using > 600 threads after is
I have a multithreaded application in which my thread utilization is very poor (in
I have very simple question but the answer is still not clear. If i
i have very simple problem. I need to create model, that represent element of
I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have a very simple WPF application in which I am using data binding
I have a multithreaded application (C++) where I need to increment/change a series of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.