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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:19:08+00:00 2026-05-21T10:19:08+00:00

I have a pylons project where I need to update some in-memory structures periodically.

  • 0

I have a pylons project where I need to update some in-memory structures periodically. This should be done on-demand. I decided to come up with a signal handler for this. User sends SIGUSR1 to the main pylons thread and it is handled by the project.

This works except after handling the signal, the server crashes with following exception:

File "/usr/lib/python2.6/SocketServer.py", line 264, in handle_request
   fd_sets = select.select([self], [], [], timeout)
select.error: (4, 'Interrupted system call')

Is it possible to fix this?

TIA.

  • 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-21T10:19:09+00:00Added an answer on May 21, 2026 at 10:19 am

    Yes, it is possible, but not easy using the stock Python libraries. This is due to Python translating all OS errors to exceptions. However, EINTR should really cause a retry of the system call used. Whenever you start using signals in Python you will see this error sporadically.

    I have code that fixes this (SafeSocket), by forking Python modules and adding that functionality. But it needs to be added everywhere system calls are used. So it’s possible, but not easy. But you can use my open-source code, it may save you years of work. 😉

    The basic pattern is this (implemented as a system call decorator):

    # decorator to make system call methods safe from EINTR
    def systemcall(meth):
        # have to import this way to avoid a circular import
        from _socket import error as SocketError
        def systemcallmeth(*args, **kwargs):
            while 1:
                try:
                        rv = meth(*args, **kwargs)
                except EnvironmentError as why:
                    if why.args and why.args[0] == EINTR:
                        continue
                    else:
                        raise
                except SocketError as why:
                    if why.args and why.args[0] == EINTR:
                        continue
                    else:
                        raise
                else:
                    break
            return rv
        return systemcallmeth
    

    You could also just use that around your select call.

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

Sidebar

Related Questions

I have a Pylons controller (irrelevant but explains why I have this need) say
I'm using the SQLAlchemy Python ORM in a Pylons project. I have a class
I have a Pylons app where I would like to move some of the
For now I have the following lines in a project configuration on pylons: [server:main]
i have a input tag which is non editable, but some times i need
I have a pylons app myapp and I need all log messages from a
I have installed pylons based application from egg, so it sits somewhere under /usr/lib/python2.5/site-packages.
I have Pydev installed and running without problem with Python 2.6. I installed Pylons
It appears to me that Django and Pylons have different ideas on how middleware
I have a Pylons app that I am ready to deploy for the first

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.