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

Table: Assure unique table.ids when unpickling #6552

Merged
merged 6 commits into from
Sep 1, 2023

Conversation

VesnaT
Copy link
Contributor

@VesnaT VesnaT commented Aug 25, 2023

Issue

Different Tables could have the same ids when unpickled.

Description of changes

Create new table.ids in __setstate__.

Includes
  • Code changes
  • Tests
  • Documentation

@markotoplak
Copy link
Member

/rebase

@markotoplak markotoplak self-assigned this Aug 31, 2023
@markotoplak
Copy link
Member

This is crazy! Changing setstate seems to have broken linux tests. Linux runs SQL tests too and our tests just freeze after a while.

The previous version used obj.X.shape inside the locked part, but the
problem was that SqlTable downloaded data when .X was accessed, which in
turn run another _init_ids within. Now deadlocks should be impossible as
the locked part only deals with primitive variables.
@markotoplak
Copy link
Member

I figured out why tests froze. There was a deadlock on unpickling, when fresh ids were assigned for SqlTable. The old version of _init_ids locked Lock when accessing X.shape. That was problematic for SqlTables, because this downloaded the data, which tried locking again to obtain instance ids, which it could not. Therefore: deadlock!

I fixed the deadlock. Then I noticed that @VesnaT's original ids fix always caused data download for SqlTables, which I hope I fixed in the following commits.

In doing so I also had to free SqlTables from locking, because pickling tables with downloaded data did not work.

@PrimozGodec PrimozGodec merged commit 67a7ee9 into biolab:master Sep 1, 2023
15 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants