On Thu, 6 Feb 2020, commits@source.squeak.org wrote:
Christoph Thiede uploaded a new version of System to project The Inbox: http://source.squeak.org/inbox/System-ct.1136.mcz
==================== Summary ====================
Name: System-ct.1136 Author: ct Time: 6 February 2020, 7:50:02.954648 pm UUID: 0a637557-d32d-9347-bc4b-4f2bb95a707d Ancestors: System-cmm.1131
Make Smalltalk more robust against interruptions/timeouts during sources compilation
A popular example is a test case that compiles a lot of methods and then is terminated via timeout. See [1] for an example. This commit ensures that the changes file does not remain closed when the method is curtailed.
Before probably destroyed your image, now works:
[MCSnapshotResource mockPackage unload] valueWithin: 1 seconds "you may need to adapt the limit to reproduce" onTimeout: [].
[1] http://forum.world.st/BUG-MultiByteFileStream-Object-gt-gt-error-primGetPosi...
=============== Diff against System-cmm.1131 ===============
Item was changed: ----- Method: SmalltalkImage>>forceChangesToDisk (in category 'sources, changes log') ----- forceChangesToDisk "Ensure that the changes file has been fully written to disk by closing and re-opening it. This makes the system more robust in the face of a power failure or hard-reboot."
| changesFile | changesFile := SourceFiles at: 2. (changesFile isKindOf: FileStream) ifTrue: [ changesFile flush.
SecurityManager default hasFileAccess ifTrue: [
[changesFile close] ensure: [
changesFile open: changesFile name forWrite: true]].
changesFile setToEnd].!
I don't think today's operating systems write changes to disk if you reopen the file. #sync is probably the right method here, though it may slow things down based on how often #forceChangesToDisk is sent.
Levente
SecurityManager default hasFileAccess ifTrue:[
changesFile close.
changesFile open: changesFile name forWrite: true].
changesFile setToEnd.
- ].
- !