[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Reproduceable Segmentation fault while saving images (#444)

Alistair Grant notifications at github.com
Mon Nov 18 12:50:08 UTC 2019


Hi Eliot,

I've spent some more time trying to track this down...

I've been working with a minimal pharo image, which can be downloaded from:

http://files.pharo.org/image/80/latest-minimal-64.zip


The minimal image doesn't have FreeType yet loaded, so we can rule out FreeType as the cause of this particular issue (not to say that it doesn't have problems).

Running the following script with the minimal image and a debug VM:

```
| aJson anArray |
aJson := ZnEasy get: 'https://data.nasa.gov/resource/y77d-th95.json' asZnUrl.
Array streamContents: [ :aStream |
    1 to: 400 do: [ :i |
		Stdio stdout
			<< 'ExternalAddress: ';
			print: ExternalAddress instanceCount; lf;
			<< 'Start';
			lf; flush.
        aStream nextPutAll: (STON fromString: aJson contents).
		Smalltalk garbageCollect.
		Stdio stdout
			<< 'Loop: ';
			print: i;
			lf; flush ] ].
```

Shows two things:

1. There are no instances of ExternalAddress, so the chance of this being ffi related seems quite small.
2. The script runs to completion.

So there appears to be no memory corruption up to this stage.

Modifying the script once more to save the image instead of just garbage collecting:


```
| aJson anArray |
aJson := ZnEasy get: 'https://data.nasa.gov/resource/y77d-th95.json' asZnUrl.
Array streamContents: [ :aStream |
    1 to: 400 do: [ :i |
		Stdio stdout
			<< 'ExternalAddress: ';
			print: ExternalAddress instanceCount; lf;
			<< 'Start';
			lf; flush.
        aStream nextPutAll: (STON fromString: aJson contents).
		Smalltalk saveImageInFileNamed: 'Save.', i asString, '.image'.
		Stdio stdout
			<< 'Loop: ';
			print: i;
			lf; flush ] ].
```

Results in the segmentation fault.  In this case it was while saving the 90th image:

```
$ ./validImage Save.88.image 
$ ./validImage Save.89.image 
Segmentation fault (core dumped)
```

`Save.90.image` doesn't exist, but `Save.90.changes` does.

I'll try attaching a file containing the terminal output (as much as was buffered).

Please let me know if you disagree with any of my reasoning.

The only difference between the two scripts is that the second one writes the image to disk, which seems to suggest that it's the image saving that could be the cause of the issue.

What do you think?

Thanks!
Alistair

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/444#issuecomment-555001612
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20191118/07d4eaf0/attachment.html>


More information about the Vm-dev mailing list