Mantis - Squeak
Viewing Issue Advanced Details
2149 System major always 11-02-05 10:37 11-03-05 20:20
new 3.7  
all versions of squeak open  
0002149: Accessing source-code is not thread-save
If two processes concurrently access the source code of a method they might get an invalid string that cannot be compiled. This leads to a wide range of different bugs, the one most often visible is a syntax that pops up within the image (see attached screen-shot). This is especially annoying if Squeak is used within a server environment.
See attached test.
 syntax-error.png [^] (7,785 bytes) 11-02-05 10:37 [^] (1,491 bytes) 11-02-05 11:01

11-02-05 11:26   
Ahh, I just happened to experience another prove of this particular problem: When having the process-browser open, auto update turned on, and having selected a particular process, this bug is observable again: browse around within your image, if you are 'lucky' you can see the code-browser actually load a incomplete method OR (what is more likely) the process browser will show a syntax-error morph as stated above when trying to display the stack.
11-02-05 19:11   
This isn't particularly related to source code though; more a general problem with the whole file accessing system. Unfortunately, Squeak uses one primitive to position the 'current pointer' for an open file and another to read x bytes from the current pointer. Obviously if multiple threads are working on the same file there is a reasonable chance that at some time the position and read/write will interleave and screw up your day.

The same problem is there in many low level OS libraries - Squeak just copied the model in the ANSI C stdio.h standard. I always did think it was pretty stupid. A read/write(file, pos, numbytes) is much safer.

It's one of the things that needs to be tackled by the File Team. Yet another....
11-02-05 19:11   
From Craig (

    Tim writes:

> A read/write(file, pos, numbytes) is much safer.

    The filesystem support in Flow[1] does this, for example. Flow provides a complete replacement for the current filesystem framework, by the way.
11-03-05 20:20   
On platforms where mmap() is available, it would be easy to implement such a method set.