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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:41:04+00:00 2026-05-10T17:41:04+00:00

A python script is running two parallel python processes ( created via os.fork() )

  • 0

A python script is running two parallel python processes ( created via os.fork() ) each of which eventually tries to check out a subversion repository leaf into the same working copy dir.

Before running ‘svn co …’ command in a sub-process ( via python subprocess module ) the parent python code checks if the working copy dir already exists.

  if os.path.isdir(checkout_dir):      # working copy dir already exists      return checkout_dir 

So that if it does there shouldn’t be any ‘svn co’ running, but rather immediate return from the parent function.

Nevertheless some collision happened and one of the python processes failed on ‘svn co ..’ with the following error.

checked-out failed: svn: Working copy '/tmp/qm_23683' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)** 

So the first question is why the working copy dir existence check didn’t work and the second – is there a way to find out that a working copy dir is locked by svn and loop until it is unlocked?

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. 2026-05-10T17:41:05+00:00Added an answer on May 10, 2026 at 5:41 pm

    This sounds like a potential race condition, in that something like the following can happen:

    1. Process A checks to see if the directory exists (it doesn’t yet).
    2. Process B checks to see if the directory exists (it doesn’t yet).
    3. Process A invokes svn, which creates the directory.
    4. Process B invokes svn, which subsequently fails.

    An easy way to avoid this is to have each process attempt to create the directory rather than checking for its existence. If the other process has already created the directory, the other process is guaranteed to get a well-defined error code under a very wide variety of platforms and filesystems. For instance, this is one of the only reliable ways to do synchronization on many implementations of NFS. Luckily, svn won’t care if the working directory already exists.

    The Python code would look something like this:

    import os, errno  # ...  try:   os.mkdir(dirName) except OSError, e:   if e.errno != errno.EEXIST: raise # some other error   print 'Directory already exists.' else:   print 'Successfully created new directory.' 

    This technique is easy to implement, very reliable, and useful in a wide variety of situations.

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

Sidebar

Ask A Question

Stats

  • Questions 60k
  • Answers 60k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer From the looks of it I have to say that… May 11, 2026 at 9:29 am
  • added an answer I ended up not using filters for my complex queries.… May 11, 2026 at 9:29 am
  • added an answer Are you trying to detect if the string they entered… May 11, 2026 at 9:29 am

Related Questions

A python script is running two parallel python processes ( created via os.fork() )
I have got a python script which is creating an ODBC connection. The ODBC
I have a python script that is a http-server: http://paste2.org/p/89701 , when benchmarking it
Is it possible for a python script to open its own source file and
Is it possible to capture Python interpreter's output from a Python script? Is it
A python script need to spawn multiple sub-processes via fork(). All of those child
How do I have a Python script that can accept user input and how
I'm writing a python script that executes a csh script in Solaris 10. The
I have a Python script I recently wrote that I call using the command
I have a python script that analyzes a set of error messages and checks

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.