Ticket #905 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Apparent race condition in gui:background-process-run-function

Reported by: rongarret Owned by: gb
Priority: major Milestone:
Component: IDE Version: trunk
Keywords: Cc:

Description

This:

(dotimes (i 3) (gui:background-process-run-function "foo" (lambda () (print 123))))

results in one successfully spawned process and one that reports:

Error: "Untitled 2" already exists

(with one of the most horrifically long backtraces I have ever seen from a process that did not actually overflow the stack).

But this:

(dotimes (i 2) (gui:background-process-run-function "foo" (lambda () (print 123))) (sleep 0.01))

results in two successfully spawned processes. These results are repeatable for N>2. My guess is this is a race condition having to do with the naming of the windows that are created by the underlying deferred-cocoa-listener-output-streams but I have not been able to verify this.

Change History

comment:1 Changed 2 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

comment:2 Changed 2 years ago by gb

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [15183]) In ENSURE-DEFERRED-STREAM-INFO-FOR-IO, force the document object (and all of the related infrastructure) to be created on the event thread. This is probably a good idea in general and doing this avoids the race condition described in ticket:905.

Hemlock buffer creation isn't really thread-safe; if we ever want it to be, we might want to do locking/serialization at a different level.

Fixes ticket:905 in the trunk.

Note: See TracTickets for help on using tickets.