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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:34:44+00:00 2026-06-17T03:34:44+00:00

When I use multiprocessing.Queue.get I sometimes get an exception due to EINTR. I know

  • 0

When I use multiprocessing.Queue.get I sometimes get an exception due to EINTR.

I know definitely that sometimes this happens for no good reason (I open another pane in a tmux buffr), and in such a case I would want to continue working and retry the operation.

I can imagine that in some other cases The error would be due to a good reason and I should stop running or fix some error.

How can I distinguish the two?

Thanks in advance

  • 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-17T03:34:45+00:00Added an answer on June 17, 2026 at 3:34 am

    The EINTR error can be returned from many system calls when the application receives a signal while waiting for other input. Typically these signals can be quite benign and already handled by Python, but the underlying system call still ends up being interrupted. When doing C/C++ coding this is one reason why you can’t entirely rely on functions like sleep(). The Python libraries sometimes handle this error code internally, but obviously in this case they’re not.

    You might be interested to read this thread which discusses this problem.

    The general approach to EINTR is to simply handle the error and retry the operation again – this should be a safe thing to do with the get() method on the queue. Something like this could be used, passing the queue as a parameter and replacing the use of the get() method on the queue:

    import errno
    
    def my_queue_get(queue, block=True, timeout=None):
        while True:
            try:
                return queue.get(block, timeout)
            except IOError, e:
                if e.errno != errno.EINTR:
                    raise
    
    # Now replace instances of queue.get() with my_queue_get(queue), with other
    # parameters passed as usual.
    

    Typically you shouldn’t need to worry about EINTR in a Python program unless you know you’re waiting for a particular signal (for example SIGHUP) and you’ve installed a signal handler which sets a flag and relies on the main body of the code to pick up the flag. In this case, you might need to break out of your loop and check the signal flag if you receive EINTR.

    However, if you’re not using any signal handling then you should be able to just ignore EINTR and repeat your operation – if Python itself needs to do something with the signal it should have already dealt with it in the signal handler.

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

Sidebar

Related Questions

I have a downloader function that downloads multiple files parallely. I use multiprocessing.Pool.map_async in
I'm trying to use a queue with the multiprocessing library in Python. After executing
In python we can use multiprocessing modules. If there is a similar library in
How does one use multiprocessing to tackle embarrassingly parallel problems ? Embarassingly parallel problems
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;
I want to use Python's multiprocessing to do concurrent processing without using locks (locks
I have code like the following, class _Process(multiprocessing.Process): STOP = multiprocessing.Manager().Event() def __init__(self, queue,
I'm trying to use python's multiprocessing module to run a distributed task over a
I use Multiprocessing in Python in order to do several requests to a database
I'm trying to use multiprocessing 's Pool.map() function to divide out work simultaneously. When

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.