-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fix a rare crash in the garbage collector while restoring a workspace #5371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch! Unfortunately it now has a conflict. I left a few suggestions.
@@ -388,8 +388,14 @@ void CHANGED_BAG(Bag b); | |||
|
|||
extern Bag * YoungBags; | |||
extern Bag ChangedBags; | |||
|
|||
#ifdef GAP_KERNEL_DEBUG | |||
BOOL InWorkspaceRestore(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BOOL InWorkspaceRestore(void); | |
BOOL InWorkspaceRestore(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The place where I've put it is where clang-format wants to put it (I guess to line us with the variables above?), so I'd prefer to leave it there, else it might just move in future if we ever clang-format everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I thought it would be the other way around
271ca0f
to
7c41a55
Compare
Now (hopefully) all fixed up |
src/objset.c
Outdated
AddObjMapNew(new, obj, | ||
READ_SLOT(map, i*2+1)); | ||
AddObjMapNew(new, obj, READ_SLOT(map, i * 2 + 1)); | ||
CHANGED_BAG(new); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed as no GC can occur in this loop, and afterwards SwapMasterPointer ensures both bags are marked aa changed (so the two CHANGED_BAG calls after it could also go)
7c41a55
to
1b962cd
Compare
While we are loading a workspace, gasman is kept in a slightly-inconsistent state, with various pointers only set at the end. This means we mustn't call functions like NewBag, ResizeBag and (the problem we were hitting, subtly), CHANGED_BAG.
This stops objset/objmap from calling CHANGED_BAG, and adds asserts to make sure this doesn't happen again in future (and verifies nothing else is calling any of these methods).