Skip to content
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

MakeImmutable fails with error "Argument has inaccessible subobjects" #58

Open
mohamed-barakat opened this issue Mar 17, 2015 · 4 comments
Assignees
Labels
gapdays2015-spring Issues and PRs that arose at https://www.gapdays.de/gapdays2015-spring kind: bug Issues describing general bugs, and PRs fixing them topic: HPC-GAP Issues and PRs related to HPC-GAP

Comments

@mohamed-barakat
Copy link
Member

MakeImmutable breaks the backwards compatibility of HPCGAP with GAP4:

gap> LoadPackage( "MatricesForHomalg" );
true
gap> ZZ := HomalgRingOfIntegers( );
Z
gap> m := HomalgInitialMatrix( 2, 2, ZZ );
<An initial 2 x 2 matrix over an internal ring>
gap> InfoOfObject( m );
rec( attributes := rec( NrColumns := 2, NrRows := 2 ), components := rec( ring := Z ),
  object := <An initial 2 x 2 matrix over an internal ring>, properties := rec( IsEmptyMatrix := false, IsInitialMatrix := true ) )
gap> MakeImmutable( m );
Error, MakeImmutable: Argument has inaccessible subobjects
not in any function at line 5 of stream
@mohamed-barakat mohamed-barakat added the topic: HPC-GAP Issues and PRs related to HPC-GAP label Mar 17, 2015
@olexandr-konovalov olexandr-konovalov added the gapdays2015-spring Issues and PRs that arose at https://www.gapdays.de/gapdays2015-spring label Mar 17, 2015
@fingolfin fingolfin changed the title Error, MakeImmutable: Argument has inaccessible subobjects MakeImmutable fails with error "Argument has inaccessible subobjects" Dec 16, 2015
@fingolfin fingolfin added the kind: bug Issues describing general bugs, and PRs fixing them label Dec 16, 2015
@fingolfin
Copy link
Member

Actually, m in this situation is already immutable. And then MakeImmutable should be an idempotent. But it isn't, due to checks performed in the kernel. Specifically, PreMakeImmutableCheck checks whether we have exclusive write access to the object (which we don't, as it lives in the public region, which is fine, given that it is immutable).

I guess this means the kernel should first check whether the object already is immutable; if it is, do nothing and return.

@fingolfin
Copy link
Member

One fix would be to modify CheckedMakeImmutable (which generates the error we are seeing here) to call IS_MUTABLE_OBJ, like it sibling MakeImmutable does. But I am not sure if this would have bad side effects... :-/

@rbehrends Any comments?

@rbehrends
Copy link
Contributor

The problem is slightly more complicated. PreMakeImmutableCheck() already tests if the top-level object is immutable, and CheckedMakeImmutable() then just calls MakeImmutable() if the check passes.

What we're seeing seems to happen (I think) because m is an atomic component object and mutability here implies that RESET_FILTER_OBJ() needs to be called (same for atomic positional objects). We need to special-case these tnums both in the traversal logic and in the MakeImmutable() table (so that the filter update is actually thread-safe in case two threads try to do this simultaneously).

A related problem that remains is how to handle MakeImmutable() for T_DATOBJ; we've discussed this before: a possible solution would be to use MakeReadOnly() underneath, but that would require some additional hackage in the kernel.

markuspf pushed a commit to markuspf/gap that referenced this issue Mar 12, 2017
This keeps track of the source file for gen/foobar.c, i.e.
either src/foobar.c or hpcgap/src/foobar.c
And in the latter case, if hpcgap/src/foobar.c is deleted,
then we now automatically trigger a rebuild of gen/foobar.c

Fixes gap-system#58
@stevelinton
Copy link
Contributor

Just run into this again in #3592 My test code makes a mutable attribute storing object and then makes it immutable with MakeImmutable. That gives this error, even when the object actually has no subobjects (except its type, which I assume is the offender here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gapdays2015-spring Issues and PRs that arose at https://www.gapdays.de/gapdays2015-spring kind: bug Issues describing general bugs, and PRs fixing them topic: HPC-GAP Issues and PRs related to HPC-GAP
Projects
None yet
Development

No branches or pull requests

5 participants