Opened 10 years ago

Closed 10 years ago

#14242 closed defect (fixed)

Race condition in gap_reset_workspace()

Reported by: Jeroen Demeyer Owned by: William Stein
Priority: blocker Milestone: sage-5.9
Component: interfaces Keywords:
Cc: Volker Braun Merged in: sage-5.9.beta0
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Consider this script gap_race.sage:

from multiprocessing import Process
import time

def rungap():
    gap("42")

P = [Process(target=rungap) for i in range(4)]
for p in P:
    p.start()
    time.sleep(0.1)

When executing with ./sage --nodotsage gaprace.sage, this should run without producing errors. But it doesn't, due to race conditions in gap_reset_workspace().

Attachments (1)

14242_gap_workspace_race.patch (4.6 KB) - added by Jeroen Demeyer 10 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by Jeroen Demeyer

Authors: Jeroen Demeyer
Cc: Volker Braun added
Status: newneeds_review

comment:2 Changed 10 years ago by Volker Braun

Looks good. But on Windows, os.rename() will raise an OSError if destination exists. Not sure if that applies to Cygwin, but better safe than sorry?

Changed 10 years ago by Jeroen Demeyer

comment:3 Changed 10 years ago by Jeroen Demeyer

Updated.

comment:4 Changed 10 years ago by Volker Braun

Reviewers: Volker Braun
Status: needs_reviewpositive_review

Looks good to me

comment:5 Changed 10 years ago by Jeroen Demeyer

Merged in: sage-5.9.beta0
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.