hogoww / Polyphemus

Visualisation of memory for Pharo images at the Virtual Machine level
GNU General Public License v3.0
15 stars 3 forks source link

How to install or get Polyphemus ? #26

Open labordep opened 1 year ago

labordep commented 1 year ago

I don't understand the way to get (or install) and use Polymphemus on my PC.

I have tried that :

Metacello new
   baseline: 'Polyphemus';
   repository: 'github://hogoww/Polyphemus:main';
    onConflictUseIncoming;
    ignoreImage;
   load.

But an exception is raised during the loading (DirectoryDoesNotExist: Path ... Pharo/images/Polyphemus/pharo-vm/smalltalksrc.

Can you add some documentation or a link to get it ?

hogoww commented 1 year ago

But an exception is raised during the loading (DirectoryDoesNotExist: Path ... Pharo/images/Polyphemus/pharo-vm/smalltalksrc.

Using the script, it works on my computer, although it hangs while dowloading VMMaker as a dependency, which can take a few minutes. Could you post a screenshot of the stack please, to try to get an idea ?

labordep commented 1 year ago

Thanks for your answer. I have this :

image

I have see that the Polyphemus project is store with FileTree, I am working always with Tonel.

My config :

labordep commented 1 year ago

There is this line in the baseline :

LibC runCommand: 'git clone https://github.com/pharo-project/pharo-vm.git'.

I haven't git on my PC (And I don't want to have it). Another potential problem ?

hogoww commented 1 year ago

There is this line in the baseline :

LibC runCommand: 'git clone https://github.com/pharo-project/pharo-vm.git'.

I haven't git on my PC (And I don't want to have it). Another potential problem ?

I was about to tell you, but I encountered an infinite loop while trying to load on window. This is an optimization that reduces the load time of VMMaker by about 4 minutes. (CI went from 10 minutes to 4 !) This should probably check whether git is installed somehow.

labordep commented 1 year ago

I don't understand what is the problem, having git ? loading time ?

hogoww commented 1 year ago

I don't understand what is the problem, having git ? loading time ?

My issue, I do not know yet. For you, it looks like the git optimization is the issue, as it is not able to download VMMaker.

Using git instead of Pharo to clone a project is way faster.

labordep commented 1 year ago

Ok I understand, but for me the fast is not grave, I prefer having a maximum features with Pharo. I prefer limit multiple software installations on my PC. If it's possible to do git clone with Pharo it should be the default way.

hogoww commented 1 year ago

Yeah, in an ideal world that would be the case !

Regardless, in the meantime, I removed the git call so you can use it. You have to install the Pharo-Project/Pharo-VM yourself by hand so it loads :)

labordep commented 1 year ago

I don't know how to get the Pharo-VM project, here is what I tried but it doesn't work:

Metacello new
   baseline: 'VMMaker';
   repository: 'github://pharo-project/pharo-vm/VMMaker:pharo-10/smalltalksrc';
    onConflictUseIncoming;
    ignoreImage;
   load.

What version of the Pharo image you need, 10, 11 ? Why you don't offer a ready to start pharo image ? Because for the moment I don't want to rebuild it but just use it :)

hogoww commented 1 year ago

Both Pharo 10 & 11 should work, although we mostly used to work on 11. I do not use Metacello, but this seems to work for me:

Metacello new
   baseline: 'VMMaker';
   repository: 'github://pharo-project/pharo-vm:pharo-10';
    onConflictUseIncoming;
    ignoreImage;
   load.

/!\ This is slow , my image hangs for about 10/15 minutes while loading the Pharo VM./!\

Because I have a new job and we have moved on from this project. Also, we had a ready to start Pharo Image, which didn't work for you. I can provide small fixes as I did, or small advices as above but there will be no long term support without a paying contract.

labordep commented 1 year ago

Thanks @hogoww I will test to load without Wifi.

labordep commented 1 year ago

Then, on Polyphemus loading I have a problem : a lot of Prompt windows opened and closed in a loop... I don't know if this is normal or not but after a lot of minutes there is no evolution... and the number of windows increase.

I have captured a video :

https://user-images.githubusercontent.com/49183340/227714555-5c4e0f30-f732-4dd6-9ad2-071b12021e08.mp4

All window prompt are similar like that : image

Side Pharo the loading bar is freeze during these windows : image

Do you have this problem ?

hogoww commented 1 year ago

I haven't on Linux / MaxOS, but that was the issue I encountered on Windows. I thought it was related to metacello which executes the baseline script. Now I'm thinking it might be related to paths in windows, because I download clean P11 images on baseline.

I'll try to take a look this weekend.

labordep commented 1 year ago

Thanks :)

hogoww commented 1 year ago

You should be able to load it properly now. Some test cases will not work, as they rely on online resources that I have disabled for Windows. Basically, I am using wget explictly, which isn't available (at least by default) on windows.

Please let me know if you encounter further issues.

hogoww commented 1 year ago

I just also removed another "bug", which does not affect loading per se. But now you should not have anymore error during loading.

labordep commented 1 year ago

Thank @hogoww, it works ! I can launch Polyphemus and play with it. But the problem is that I haven't any "square" in the graphical view :/ (last tabs) I send to you a screenshot when I have the image with me.

hogoww commented 1 year ago

Thank @hogoww, it works ! I can launch Polyphemus and play with it.

Good :)

But the problem is that I haven't any "square" in the graphical view :/ (last tabs) I send to you a screenshot when I have the image with me.

What image are you trying to open ? A freshly downloaded one or something specific ? Maybe a corrupted one?

labordep commented 1 year ago

The image that I'm trying to open is an image that I cannot start (broken). I don't know why this image is broken, that's why I'm trying to use Polyphemus to investigate the problem and eventually remove problematic instances. I suppose that an object instance have a problem inside because I'm using libraries with FFI calls like OS-Windows.

This is Pharo 11 64bits image, created last week with some OS-Windows libraries loaded inside.

Some screenshots after start an analysis :

image

image

image

image

Alisu commented 1 year ago

Hello, in the memory scripter tab you can inspect reifiedMemory (select and ctrl + i). There, you should have a collection of broken references if there is some, a broken reference is reified as an AbnormalObject. You can also recreate this collection with:

self select: [:anOop | anOop isAbnormalOop ]

In the case the collection is empty, it means that Polyphemus managed to read the file in its entirety.

You can find the list of objects in the objects collection (objects are ordered by address in there and you probably wants to look at the objects at the end).

If you need more help, PM me or continue in this issue.

hogoww commented 1 year ago

The image that I'm trying to open is an image that I cannot start (broken). I don't know why this image is broken, that's why I'm trying to use Polyphemus to investigate the problem and eventually remove problematic instances. I suppose that an object instance have a problem inside because I'm using libraries with FFI calls like OS-Windows.

Have you tried to execute the image with the command line ? The command line should report whether that's a meta error of the startup, or a corrupted image. Other than that, what Alisu said !

labordep commented 1 year ago

The image that I'm trying to open is an image that I cannot start (broken). I don't know why this image is broken, that's why I'm trying to use Polyphemus to investigate the problem and eventually remove problematic instances. I suppose that an object instance have a problem inside because I'm using libraries with FFI calls like OS-Windows.

Have you tried to execute the image with the command line ? The command line should report whether that's a meta error of the startup, or a corrupted image. Other than that, what Alisu said !

Thanks @Alisu, I'm starting to test your instructions. @hogoww, for answer to you, I have no messages when I launch my broken image with a PowerShell prompt.

labordep commented 1 year ago

I have done that :)

When I'm inspecting reifiedMemory (focus on objects) :

image

I have objects :)

Here the result of self select: [:anOop | anOop isAbnormalOop ] DoIt :

image

This is empty and this is a good point if I understand you.

I continue to investigate, thanks :)

hogoww commented 1 year ago

@hogoww, for answer to you, I have no messages when I launch my broken image with a PowerShell prompt.

Oh. That is very surprising to me. I have no idea of why that could be right about now... u_u. @Alisu You got anything?

Having no "Abnormal Objects" means that there does not seem to be any corruption in this image. So that is indeed great !

Alisu commented 1 year ago

Interesting. A thing to do would be something similar to branch recoveryFreeListV2. We can modify the method OopAbstractObject >> allReifiedSlots to add an halt like this:

allReifiedSlots

    | errorBlock |

    errorBlock := [ 1halt. memory objectAt: memory nilObject ].
    ^ (1 to: self numSlots) collect: [ :anIndex | 
          [ self reifiedSlotAt: anIndex ] onErrorDo: errorBlock ]

then in reifiedMemory run the script:

self do: [ :anOop | anOop allReifiedSlots ]

It should force the traversal of every reference in the observed image. If it halts then there is a reference pointing to something that is not an object. If it does not halt then you don't have a corrupted memory.

In the second case, it means that you, very probably, have a runtime problem. It can be a really long processing that seems like the image hang, an infinite recursion or something even different (you never know with ffi). Unfortunately Polyphemus does not handle runtime problems as it works with a static snapshot of the memory. I started something in the branch HackDebugger in this sense but stopped because of ressources and time.

If you arrive to this point and you really want to recover this image, I advice you to run the vm with the image with LLDB and you can ask the Pharo team to help you with that. Once you know what is the problem (in case of infinite recursion the method causing it) you can use again Polyphemus to modify it externally.

hogoww commented 1 year ago

Oh, an infinite loop in the startup would make a lot of sense.