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 9257511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:10:32+00:00 2026-06-18T12:10:32+00:00

I have a small crawling application written in Python 2.7 that uses threads to

  • 0

I have a small crawling application written in Python 2.7 that uses threads to fetch a lot of URLs. But it doesn’t close cleanly or respond properly to a KeyboardInterrupt, although I tried to fix the latter issue with some advice I found here.

def main():
    ...
    for i in range(NUMTHREADS):
        worker = Thread(target=get_malware, args=(malq,dumpdir,))
        worker.setDaemon(True)
        worker.start()

    ...

    malq.join()


if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        sys.exit()

I need to make sure that it will exit properly when I hit Ctrl-C or when it completes its run rather than having to Ctrl-Z and kill the job.

Thanks!

  • 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-06-18T12:10:33+00:00Added an answer on June 18, 2026 at 12:10 pm

    There are discussions about how GIL could affect signal handling for Python applications with multiple threads that are IO bound. apparently IO bound threads cause the main thread starve for process time and not be able to handle signals as supposed to. I suggest looking at alternative parallel processing options (like subprocess module, or multiprocessing) or asynchronous frameworks (like asyncoro)

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

Sidebar

Related Questions

I have small application that is uploading pictures to another website via webservice. My
A little back story : I have small application that will use Word to
I have small python code that implements the quickselect discussed here . import random
I have small question. When I started to programm my application, I grouped types
I have small web app that generate PDF files as a report. I'm trying
I have small python script in which I look for a pattern in the
I am generating new xml file using perl script but I have small problem,
I have small application using JSF 1.1. It is using NTLM for authentication. What
I have small TFTP server running on port 8080. It is an Android application.
i have small problem i.e. their is one celltable with lot of data it

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.