<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi Levente,</p>
<p><br>
</p>
<p>for a start, my only objective was to increase the robustness. Do you think #ensure: is an appropriate approach for that? :)</p>
<div id="x_Signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">
<div class="x__rp_U4 x_ms-font-weight-regular x_ms-font-color-neutralDark x_rpHighlightAllClass x_rpHighlightBodyClass" id="x_Item.MessageUniqueBody" style="font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif,serif,EmojiFont">
<div dir="ltr">
<div id="x_divtagdefaultwrapper"><font face="Calibri,Helvetica,sans-serif,EmojiFont,Apple Color Emoji,Segoe UI Emoji,NotoColorEmoji,Segoe UI Symbol,Android Emoji,EmojiSymbols">
<div id="x_Signature">
<div style="margin:0px"><font style="font-family:Calibri,Arial,Helvetica,sans-serif,serif,EmojiFont"></font></div>
</div>
</font></div>
</div>
</div>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody"><br>
</div>
<div class="x__rp_T4" id="x_Item.MessagePartBody">> <span style="font-size:12pt">I don't think today's operating systems write changes to disk if you </span><span style="font-size:12pt">reopen the file.</span>
<div><br>
</div>
<div>Could you explain this? :) If the file is closed, the OS cannot know we want to reopen it after. So it must save (or reject) any changes and release the resource so that any other applications are enabled to access it. What's wrong with this understanding?
 And how can #sync (= flush) be slower than reopening, which requires flushing as well?</div>
<div><br>
</div>
<div>By the way, it appears that there are many, many calls to #forceChangesToDisk while loading/unloading a Monticello snapshot ... Should we maybe use something like #cacheDuring: for this operation?</div>
<div><br>
</div>
<div>Best,</div>
<div>Christoph</div>
</div>
</div>
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Levente Uzonyi <leves@caesar.elte.hu><br>
<b>Gesendet:</b> Freitag, 7. Februar 2020 10:52:03<br>
<b>An:</b> squeak-dev@lists.squeakfoundation.org<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: System-ct.1136.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Thu, 6 Feb 2020, commits@source.squeak.org wrote:<br>
<br>
> Christoph Thiede uploaded a new version of System to project The Inbox:<br>
> <a href="http://source.squeak.org/inbox/System-ct.1136.mcz">http://source.squeak.org/inbox/System-ct.1136.mcz</a><br>
><br>
> ==================== Summary ====================<br>
><br>
> Name: System-ct.1136<br>
> Author: ct<br>
> Time: 6 February 2020, 7:50:02.954648 pm<br>
> UUID: 0a637557-d32d-9347-bc4b-4f2bb95a707d<br>
> Ancestors: System-cmm.1131<br>
><br>
> Make Smalltalk more robust against interruptions/timeouts during sources compilation<br>
><br>
> 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.<br>
><br>
> Before probably destroyed your image, now works:<br>
><br>
>        [MCSnapshotResource mockPackage unload]<br>
>                valueWithin: 1 seconds "you may need to adapt the limit to reproduce"<br>
>                onTimeout: [].<br>
><br>
> [1] <a href="http://forum.world.st/BUG-MultiByteFileStream-Object-gt-gt-error-primGetPosition-failed-td5111181.html">
http://forum.world.st/BUG-MultiByteFileStream-Object-gt-gt-error-primGetPosition-failed-td5111181.html</a><br>
><br>
> =============== Diff against System-cmm.1131 ===============<br>
><br>
> Item was changed:<br>
>  ----- Method: SmalltalkImage>>forceChangesToDisk (in category 'sources, changes log') -----<br>
>  forceChangesToDisk<br>
>        "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."<br>
><br>
>        | changesFile |<br>
>        changesFile := SourceFiles at: 2.<br>
>        (changesFile isKindOf: FileStream) ifTrue: [<br>
>                changesFile flush.<br>
> +              SecurityManager default hasFileAccess ifTrue: [<br>
> +                      [changesFile close] ensure: [<br>
> +                              changesFile open: changesFile name forWrite: true]].<br>
> +              changesFile setToEnd].!<br>
<br>
I don't think today's operating systems write changes to disk if you <br>
reopen the file.<br>
#sync is probably the right method here, though it may slow things <br>
down based on how often #forceChangesToDisk is sent.<br>
<br>
Levente<br>
<br>
> -              SecurityManager default hasFileAccess ifTrue:[<br>
> -                      changesFile close.<br>
> -                      changesFile open: changesFile name forWrite: true].<br>
> -              changesFile setToEnd.<br>
> -      ].<br>
> - !<br>
<br>
</div>
</span></font>
</body>
</html>