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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:25:00+00:00 2026-05-22T02:25:00+00:00

I have a main process that spawns Processes and then those Processes add jobs

  • 0

I have a main process that spawns Processes and then those Processes add jobs to a Queue which the main process uses to spawn more processes. And, that works fine for about 20 seconds and then the main process just stops spawning jobs even though it has plenty of jobs in the queue.

here’s the code for the job process’s run loop:

try:
    page = self.fetch_page(self.url, self.timeout)
    if page != None:
        #do_stuff
        pass 
except Exception, e:                           #Log any errors
    import traceback
    self.log(str(traceback.format_exc(limit=10)), level="error")
    self.log(str(e), level="error")
finally:
    import os, signal
    print "releasing Semaphore"
    self.__sem.release()
    #print "Joining pQueue" #these statements raise errors...
    #self.__pqueue.join_thread()
    #print "Joining lQueue"
    #self.__log.join_thread()
    print "exiting"
    os._exit(1)
    #os.kill(self.pid, signal.SIGTERM)

And here’s the code for main process that spawns the jobs:

while True:
    print "Waiting for url"
    url = self.page_queue.get()
    print "waiting for semaphore"
    self.__sem.acquire()
    print "semaphore recived"
    process = self.process_handler(url, self.log_queue, self.__sem, self.page_queue)
    process.start()

Just a little context, self.log_queue in the spawning process is self.__log in the Job process, self.page_queue is self.__pqueue in the Job process, and self.__sem is the same as self.__sem in the Job process.

The spawing process usually hangs at:

url = self.page_queue.get()

I’m pretty sure that is has something to do with the Queues breaking when the Job Processes terminate before they finish writing to the queues, however that’s just a hunch. and self.__pqueue.join_thread() raises an assertion error.

  • 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-22T02:25:01+00:00Added an answer on May 22, 2026 at 2:25 am

    Ok, I got it fixed. My first hunch was that the Queues were being killed on the write. However, after checking to make sure that the queue had values in it using Queue.qsize(), I began thinking that it was the semaphore that was causing the problem. So I looked into multiprocessing Manager objects, objects that allow process to manipulate their data via “proxies”. So I switched the logic so that all of the Queues and Semaphores would be controlled by Manager objects and that seems to have worked out perfectly. Link to the applicable python docs: http://docs.python.org/library/multiprocessing.html#sharing-state-between-processes

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

Sidebar

Related Questions

I have a main application that spawns a seperate thread to process messages off
I have a MAIN process that spawn an implementation of a gen_fsm behavior, but
Here is the scenario: I have a java main process, which uses JMS to
I have a Java program that uses reflection to find and invoke the main(String[]
I have a C linux application (A) that spawns another process (P) when it
I have a .net app that needs to spawn a console process (a java
I have one main application which launch two other process's, i just need to
I have main table called 'Employee' and another slave table called 'EmployeeTypes' that has
i have a table called category in which i have main category ids and
I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath

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.