-
-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing class side variable after reloading a Trait which used another Trait, from GitHub + image unstability and crashs #14749
Comments
There was some updates in loading code in Pharo 12 but if it also happens in Pharo 11 it is probably not related to that. I'll try to find some time next week to look into it since I recently learned more about the code managing loading classes and traits, |
Thanks @jecisc :) this problem is impacting our architecture framework at the core of all our applications :( |
Pierre do I guess correctly that it was working correctly in P10? |
This is really strange because Moose is heavily using traits and they do not experience this problem so I'm really curious. |
I have tested to load my project in Pharo 10, you can try with this script : Metacello new
baseline: 'Molecule';
repository: 'github://OpenSmock/Molecule:dev-99';
load. And this is the same problem :/ And on GitHub : Very strange! And the commit window is curious because it seams that the system know there is a difference but it cannot show it correctly : |
May be Molecule can impact in a way this bug, can you reproduce this problem ? |
I writted a project to reproduce : https://github.com/labordep/Project14749
|
- MCClassDefinition>>createClass should not hardcode a global access - MCTraitDefinition>>createClass should not set the class slots and comment outside the class builder - MCTraitDefinition>>createClass should catch the same warning as the overriden method (I guess? Or it should be removed in both? If someone knows this part of the system better than me let me know what you think :) ) I found this looking at pharo-project#14749 but this does not fix the problem
I found the problem but I do not know yet how to fix it. The problem is that for traits we have MCTraitDefinition and MCClassTraitDefinition in Monticello. Things such as class slots and managed by MCTraitDefinition and are installed correctly. But the class trait composition is set by MCClassTraitDefinition afterward and this removes anything else configured in the class side. I don't understand why we have both those classes and not just one. I need to talk to Pablo to see if we can unify. But anyway, knowing the root of the problem I'll at least be able to produce a workaround. |
This is a fix for issue pharo-project#14749 in Pharo 11. The fix is different than in Pharo 12 because in Pharo 12 I�did cleaner version of the clean by removing the usage of MCClassTraitDefinition alltogether since all infos are already on MCTraitDefinition. The workaround here is to not recompile entirelly the class trait if the base trait is already present in the image. Instead it will just update the trait composition, thus it will not remove the instance variables.
So I did a workaround for Pharo 11: #14768 And for Pharo 12 I have a PR on Pharo and a PR on Tonel with a better cleaning and both are passing: I am now waiting for reviews and this should fix your problem |
Thanks @jecisc! Keep me informed :) |
This should also be fixed in Pharo12 tomorrow |
I have a lot of crashs in P11 :/ |
Note: The crashes are coming from a VM that is too old probably |
@labordep This issue should be fixed in Pharo 12 too now |
Thanks @jecisc, I check this problem and if necessary open a new issue. |
Bug description
Class side variable of a Trait is removed after reloading the Trait.
Due to this problem, my Pharo image is unstable and a lot of crashes can appears.
When I'm reloading the package manually, the var is appears! But the system is not stable
The Trait on GitHub (look at
anInstanceVariable
) :The Trait after loading the project into Pharo :
Look at the red methods which are using
anInstanceVariable
.The Trait after re-loading manually the package :
Red methods are always here.
The image is always unstable, var is here but not considered.
To Reproduce
Steps to reproduce the behavior:
The problem is present when loading manually (Add button) or from a baseline script.
About crashes and unstability
The image is unstable at the moment of a Trait1 with a class side var uses a Trait2, or at the moment of we create a class side var in a Trait 1 uses Trait 2.
Expected behavior
Variable should be exists, but missing.
Screenshots
If applicable, add screenshots to help explain your problem.
Version information:
The text was updated successfully, but these errors were encountered: