[squeak-dev] Crash

Eliot Miranda eliot.miranda at gmail.com
Fri Feb 18 17:27:43 UTC 2022


Hi Jörg,

On Mon, Feb 14, 2022 at 12:46 PM Jörg Belger <unique75 at web.de> wrote:

> Ok third try to sent the mail, now without pictures and only with text :-)
>
> This I what I get in the debugger. Of course, at the moment I do not
> understand the code there, but maybe hopefully Eliot can see something
> interesting in it.  I leave VS open and look tomorrow at the code, maybe I
> understand a bit of it :-)
>
> Seems there is something wrong with the forward pointers. I assume the
> longAt(referent) fails? I guess it is a macro, but VS could not find the
> definition.
>

We should take this to opensmalltalk-vm.  But we can continue here for
now.  I think I have created a bug in the scavenger  I have my suspicions
as to what I've done wrong (I think I am not maintaining newMethod
properly).  But for now, Jörg, how do you reproduce this crash?  You're on
Windows? You're compiling which version of the VM sources? You're using a
trunk 64-bit image?  You run what exactly?


>
> ########## Code area - the red line is failing with access violation
> ###########
>
> /* begin literalCountOfMethodHeader: */
> assert((((header) & 7) == 1));
> numLiterals = ((header >> 3)) & AlternateHeaderNumLiteralsMask;
> numSlots = numLiterals + LiteralStart;
> l9: /* end numStrongSlotsOf:format:ephemeronInactiveIf: */;
> for (i = 0; i < numSlots; i += 1) {
> referent = longAt((referrer + BaseHeaderSize) + (((sqInt)((usqInt)(i) <<
> (shiftForWord())))));
> if ((!(referent & (tagMask())))) {
>
> /* a forwarding pointer could be because of become: or scavenging. */
> if ((!((longAt(referent)) & ((classIndexMask()) -
> (isForwardedObjectClassIndexPun()))))) {
> /* begin followForwarded: */
> assert(isUnambiguouslyForwarder(referent));
> /* begin fetchPointer:ofMaybeForwardedObject: */
> referent1 = longAt((referent + BaseHeaderSize) + (0U << (shiftForWord())));
> while (((!(referent1 & (tagMask()))))
> && ((!((longAt(referent1)) & ((classIndexMask()) -
> (isForwardedObjectClassIndexPun())))))) {
> /* begin fetchPointer:ofMaybeForwardedObject: */
> referent1 = longAt((referent1 + BaseHeaderSize) + (0U <<
> (shiftForWord())));
> }
> referent = referent1;
>
>
> ########## Call stack ############
>
> Squeak.exe!scavengeReferentsOf(__int64 referrer) Zeile 42680
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (42680)
> Squeak.exe!scavengeRememberedSetStartingAt(__int64 n) Zeile 42760
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (42760)
> Squeak.exe!scavengeLoop() Zeile 42542
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (42542)
> Squeak.exe!doScavenge(__int64 tenuringCriterion) Zeile 47599
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (47599)
> Squeak.exe!scavengingGCTenuringIf(__int64 tenuringCriterion) Zeile 57959
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (57959)
> Squeak.exe!sufficientSpaceAfterGC(__int64 numBytes) Zeile 58691
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (58691)
> Squeak.exe!checkForEventsMayContextSwitch(__int64 mayContextSwitch) Zeile
> 62762
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (62762)
> Squeak.exe!handleStackOverflowOrEventAllowContextSwitch(__int64
> mayContextSwitch) Zeile 66037
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (66037)
> Squeak.exe!ceStackOverflow(__int64 contextSwitchIfNotNil) Zeile 15593
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (15593)
> [Externer Code]
> Squeak.exe!ioInitHeartbeat() Zeile 420
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\platforms\win32\vm\sqWin32Heartbeat.c
> (420)
> Squeak.exe!interpret() Zeile 2875
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\src\spur64.cog\cointerp.c
> (2875)
> Squeak.exe!sqMain(int argc, char * * argv) Zeile 1761
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\platforms\win32\vm\sqWin32Main.c
> (1761)
> Squeak.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrevInstance, char
> * lpCmdLine, int nCmdShow) Zeile 1851
> unter
> C:\Users\joerg\Persoenlich\Entwicklung\Squeak\vmssource\trunk\platforms\win32\vm\sqWin32Main.c
> (1851)
> [Externer Code]
>
>
> ########## Locals ############
>
> classFormat 662660168776 __int64
> contextSize 72198296718755736 __int64
> fmt 2 __int64
> foundNewReferentOrIsWeakling 0 __int64
> header 140698790658008 __int64
> header1 140698758633160 __int64
> i 37029628 __int64
> newLocation 811789632 __int64
> numLiterals 64 __int64
> numSlots 167772160 __int64
> numSlots1 255 unsigned __int64
> numSlots2 167772160 unsigned __int64
> objOop1 72057594139401638 __int64
> referent 139599658561184 __int64
> referent1 0 __int64
> referrer 140700938141704 __int64
> sp 72058702004626295 __int64
>
>
>
>
>
>
> Am 14.02.2022 um 09:37 schrieb Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com>:
>
> Kudos Jörg for perseverating and gathering the know-how.
> Unix-style development on windows has always been a pain.
>
> Le lun. 14 févr. 2022 à 08:58, Jörg Belger <unique75 at web.de> a écrit :
>
>> It seems I have now compiled a debug vm, yeah :-)
>>
>> But in summary I think I did now the following:
>>
>> - install Cygwin with standard settings
>> - install make (GNU Version) in Cygwin installer
>> - install LLVM 13.0.0.0 (current version) in path C:\LLVM. —> this is not
>> the standard installation path that the installer wants per default
>> - install Microsoft Visual Studio Community 2022 with standard settings
>>
>> Maybe this should be reflected in the official documentation, especially
>> all the extra conditions with additional make-tool and LLVM path.
>>
>> I deinstalled VS2017 again, it seems it does not work with LLVM 13.0.0.0
>> together, there were some external references that could not be resolved
>> during compiling. But LLVM 13.0.0.0 and VS2022 seem to work together. I see
>> now many files in \building\win64x64\squeak.cog.spur\builddbg\vm and I
>> could start an image with the Squeak.exe there. So I will try to run now my
>> test code with VisualStudio debugger attached to see what happens.
>> Hopefully I will see then also a crash directly with sources.
>>
>> Jörg
>>
>> PS: It is a small step for mankind, but a big step for a VM-Jörg :-)
>>
>> Am 13.02.2022 um 18:40 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>
>> Hi Jörg,
>>
>> On Feb 13, 2022, at 12:40 AM, Jörg Belger <unique75 at web.de> wrote:
>>
>> Ok i installed that, now I get that error:
>>
>> /bin/sh: C:/LLVM/bin/clang.exe: No such file or directory
>>
>> Why do I need to install LLVM when I want to compile it with VisualStudio
>> compiler? Is there an environment variable not set correctly or does it
>> need really two compiler frameworks?
>>
>>
>> The MSVC compiler is very buggy.  For example, it can’t handle the macro
>> expansions for asserts or memory access. Clang has no such problems and
>> produces very good code.  So to use the MSVC tool chain one also has to use
>> the Clang compiler.  I’m told that Microsoft itself uses Clang internally.
>>
>>
>>
>> Am 12.02.2022 um 21:15 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>
>>
>>
>> On Feb 12, 2022, at 1:08 AM, Jörg Belger <unique75 at web.de> wrote:
>>
>> What do I need to install to get a „make“ command? VisualStudio has only
>> „nmake“ and I did not find a „make“ in Cygwin.
>>
>>
>> make is taken from Cygwin.  You’ll need  to run the cygwin installer and
>> install gnu make. (Sorry this is so involved)
>>
>>
>> Am 11.02.2022 um 22:05 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>
>>
>>
>> On Fri, Feb 11, 2022 at 1:03 PM Eliot Miranda <eliot.miranda at gmail.com>
>> wrote:
>>
>>> Hi Jörg,
>>>
>>> On Fri, Feb 11, 2022 at 9:10 AM Jörg Belger <unique75 at web.de> wrote:
>>>
>>>> Hi Eliot,
>>>>
>>>> I did that, I used a x64 Native shell from Visual Studio.
>>>>
>>>
>>> You need to use the CMD shell.  My CMD shell has the title "x64 MSVC CMD
>>> ..." and is the file C:\Program Files (x86)\Microsoft Visual
>>> Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
>>>
>>
>> Actually the ful properties for the link is:
>>
>> %comspec% /k "C:\Program Files (x86)\Microsoft Visual
>> Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
>>
>>> But it does neither work with 2022 nor with 2017, I deinstalled 2022
>>>> today and installed 2017, same result. It shows me only the first line what
>>>> the script prints out. I have currently no access to my computer, I am not
>>>> at home. But it shows only that DEBUG is started, just one line, nothing
>>>> more.
>>>>
>>>> Maybe I need to have a look into the batch files, I am afraid of that
>>>> :-)
>>>>
>>>> Jörg
>>>>
>>>> Am 11.02.2022 um 18:03 schrieb Eliot Miranda <eliot.miranda at gmail.com>:
>>>>
>>>>
>>>>
>>>> On Fri, Feb 11, 2022 at 12:51 AM Jörg Belger <unique75 at web.de> wrote:
>>>>
>>>>> I was not able so far to compile a VM. Yesterday I installed Cygwin
>>>>> with standard settings and MS VisualStudio, but Version 2022, maybe I need
>>>>> 2017. I do all the things described in the HowToBuild, but when I do
>>>>> ../common/MAKEDEBUG.bat I get only the one output line that it does the
>>>>> DEBUG, but the script immediately stops, nothing happens.
>>>>>
>>>>
>>>> You must run ..\common\MAKEDEBUG.BAT in an MSVC shell window, not a
>>>> Cygwin window.  Furst do ..\common\SETPATH.BAT, then run MAKEDEBUG.BAT
>>>>
>>>>>
>>>>> I used simply the latest debug build and attached it to VisualStudio.
>>>>> This is what I get, which means, exception raised, access violation at
>>>>>
>>>>> Ausnahme ausgelöst bei 0x00007FF75DE1878B in Squeak.exe: 0xC0000005:
>>>>> Zugriffsverletzung beim Lesen an Position 0x00005AF973234C20.
>>>>>
>>>>> Am 10.02.2022 um 21:12 schrieb Eliot Miranda <eliot.miranda at gmail.com
>>>>> >:
>>>>>
>>>>>
>>>>> On Feb 10, 2022, at 12:07 PM, Jörg Belger <unique75 at web.de> wrote:
>>>>>
>>>>> There is no crash.dmp file
>>>>>
>>>>>
>>>>> Then the only thing I can suggest is building a VM using the MSCV tool
>>>>> chain (see MSVC in opensmalltalk-vm/building/win64x64/HowToBuild), running
>>>>> that VM in the VisualStudio debugger, and seeing if that is more
>>>>> informative.
>>>>>
>>>>>
>>>>> Am 10.02.2022 um 20:58 schrieb Eliot Miranda <eliot.miranda at gmail.com
>>>>> >:
>>>>>
>>>>> HI Jörg,
>>>>>
>>>>> On Wed, Feb 9, 2022 at 11:08 PM Jörg Belger <unique75 at web.de> wrote:
>>>>>
>>>>>> Hi Dave,
>>>>>>
>>>>>> I mean with „crash“ the Squeak process is exited unexpectedly, it is
>>>>>> just fully gone away. Maybe it happens for me earlier because if have a 32
>>>>>> GB machine and I do not have so much swapping. It is not a
>>>>>> hanging/locking/unresponsivness, it is a real crash :-)
>>>>>>
>>>>>
>>>>> Is there a crash.dmp file?  If so, can you post it? It should be in
>>>>> the same directory as either the image or the vm.
>>>>>
>>>>> Here are my machine details:
>>>>>>
>>>>>> Gerätename      timemachine
>>>>>> Prozessor       AMD Ryzen 9 3900X 12-Core Processor
>>>>>>  3.80 GHz
>>>>>> Installierter RAM       32,0 GB
>>>>>> Geräte-ID       F6FA897B-DDB1-44D6-9BF3-8BD1110AA754
>>>>>> Produkt-ID      00326-10048-08575-AA867
>>>>>> Systemtyp       64-Bit-Betriebssystem, x64-basierter Prozessor
>>>>>> Stift- und Toucheingabe Für diese Anzeige ist keine Stift- oder
>>>>>> Toucheingabe verfügbar.
>>>>>>
>>>>>> Edition Windows 10 Home
>>>>>> Version 20H2
>>>>>> Installiert am  ‎23.‎03.‎2021
>>>>>> Betriebssystembuild     19042.1526
>>>>>> Leistung        Windows Feature Experience Pack 120.2212.4170.0
>>>>>>
>>>>>>
>>>>>> > Am 10.02.2022 um 04:27 schrieb David T. Lewis <lewis at mail.msen.com
>>>>>> >:
>>>>>> >
>>>>>> > On Thu, Feb 03, 2022 at 10:30:49PM +0100, J??rg Belger wrote:
>>>>>> >> This leads to an image/VM crash too
>>>>>> >>
>>>>>> >>      | oc |
>>>>>> >>      oc := OrderedCollection new.
>>>>>> >>      400000000 timesRepeat: [oc add: Object new]
>>>>>> >>
>>>>>> >> This here is working for me:
>>>>>> >>
>>>>>> >>      | oc |
>>>>>> >>      oc := OrderedCollection new: 400000000.
>>>>>> >>      400000000 timesRepeat: [oc add: Object new]
>>>>>> >>
>>>>>> >> This here is working too for me:
>>>>>> >>
>>>>>> >>      | oc |
>>>>>> >>      oc := OrderedCollection new.
>>>>>> >>      400000000 timesRepeat: [oc add: 1]
>>>>>> >>
>>>>>> >> It seems there is possibly a memory problem in the VM.
>>>>>> >>
>>>>>> >>
>>>>>> >
>>>>>> > I have tried to reproduce this on my PC with 8GB memory. I was not
>>>>>> able
>>>>>> > to crash the VM but it certainly locked my system up in swapping as
>>>>>> the
>>>>>> > test continued to use memory. Eventually I ran out of time and
>>>>>> patience
>>>>>> > and killed the VM process.
>>>>>> >
>>>>>> > If there is an actual VM crash involved then maybe there is a bug.
>>>>>> But
>>>>>> > if you are seeing your Squeak image is just stalling out, then
>>>>>> nothing
>>>>>> > is wrong except for a matter of basic arithmetic.
>>>>>> >
>>>>>> > You are trying to allocate 400,000,000 individual objects, each of
>>>>>> which
>>>>>> > requires 16 bytes of memory in the object memory, and you are
>>>>>> storing
>>>>>> > each of those objects using an 8 byte object pointer to the object
>>>>>> in
>>>>>> > the ordered collection. So just for the raw storage you are going to
>>>>>> > need for those "Object new" things, you need 400,000,000 * (16 + 8)
>>>>>> > = 9,600,000,000 bytes. On top of that you are putting the objects
>>>>>> into
>>>>>> > an OrderedCollection that does not know that you are going to ask it
>>>>>> > to hold 400,000,000 object pointers, so it has to keep extending
>>>>>> itself
>>>>>> > as the test proceeds.
>>>>>> >
>>>>>> > When I tried to run this on my PC with a mere eight GB of real
>>>>>> memory,
>>>>>> > the operating system had to start swapping out real memory make room
>>>>>> > for all of that activity. And every time the OrderedCollection needs
>>>>>> > to extend its space, it is accessing real memory that probably got
>>>>>> > swapped out to disk to make room in the 8GB of real memory space, so
>>>>>> > basically it puts the system into a death spiral that locks up the
>>>>>> > Squeak image (and pretty much everything else on my computer).
>>>>>> >
>>>>>> > So I am able to reproduce the locked up image (as I would expect on
>>>>>> my
>>>>>> > PC with only 8GB memory) but I have not been able to reproduce a
>>>>>> crash.
>>>>>> >
>>>>>> > Just to clarify, are you describing a "crash" in which the actual
>>>>>> > Squeak VM process exited unexpectedly, or was it a "crash" in the
>>>>>> > sense of the the image locking up and becoming unresponsive? If the
>>>>>> > latter, then most likely nothing is wrong.
>>>>>> >
>>>>>> > Dave
>>>>>> >
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> _,,,^..^,,,_
>>>>> best, Eliot
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> _,,,^..^,,,_
>>>> best, Eliot
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> _,,,^..^,,,_
>>> best, Eliot
>>>
>>
>>
>> --
>> _,,,^..^,,,_
>> best, Eliot
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220218/c56f1c38/attachment.html>


More information about the Squeak-dev mailing list