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

  • SEARCH
  • Home
  • 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 7007977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:40:36+00:00 2026-05-27T21:40:36+00:00

What would cause a Clojure program to not immediately exit upon finishing the last

  • 0

What would cause a Clojure program to not immediately exit upon finishing the last statement in the main function?

All I did was to change a (doall (map ...)) to a (doall (pmap ...)), and suddenly the program would hang upon completion of its tasks for a good number of seconds before exiting. I would put a (println "Finished everything!") on the last line of the -main function, and it would print that, yet still not exit for some time. What could cause this behavior, and how should I fix it?

EDIT: The pmap is the only part of the program that is parallelized (mostly because everything else runs more or less instantly). As latter parts of the program require all the results from pmap in order to function correctly, and as the program output is the same for both map and pmap, I somewhat doubt that pmap would still be running at the end of the program. Putting (System/exit 0) at the end instead of the println does not change program output, either.

  • 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-27T21:40:37+00:00Added an answer on May 27, 2026 at 9:40 pm

    pmap will spin up multiple threads from a threadpool to service your concurrent tasks.

    Calling shutdown-agents is necessary to allow the JVM to exit in an orderly manner because the threads in the agent threadpools are not daemon threads.

    You need to explicitly tell them to gracefully shutdown (but only when your program is done). This looks to have been answered before here.

    Quoting from that answer:

    “You need to call shutdown-agents to kill the threads backing the threadpool used by pmap.”

    Docs are here: http://clojuredocs.org/clojure_core/1.3.0/clojure.core/shutdown-agents

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

Sidebar

Related Questions

Is there anything that would cause MonoTouch to not generate crash reports when the
How can I cause a Clojure macro to act as a function, so I
In clojure, I would like to create a record inside a function. I tried:
Is there a way to tell subversion update/merge unless it would cause a conflict?
I have a Guid.NewGuid() call that is creating an Empty Guid. What would cause
What would possibly cause a 'git push' to try and commit to two branches?
Would the code bellow cause my code to leak? More specifically, am I responsible
Does dependency injection potentially cause large overhead? I would imagine so, especially if the
What is the recommended method formatting large clauses inside a cond statement in Clojure?
What would cause a table view cell to remain highlighted after being touched? I

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.