Skip to content

Returning a view when memory mapping is used raises Permission error on windows#944

Closed
albertcthomas wants to merge 3 commits intojoblib:masterfrom
albertcthomas:memmap-test
Closed

Returning a view when memory mapping is used raises Permission error on windows#944
albertcthomas wants to merge 3 commits intojoblib:masterfrom
albertcthomas:memmap-test

Conversation

@albertcthomas
Copy link
Copy Markdown
Contributor

Following #942 (comment) I added a non regression test for when a view of a memory mapped object is returned.
This raises a Permission error on windows (to be confirmed by CI). However I am not sure about the expected behavior in this case. In a way it makes sense to have an error but I don't think it is the case with macOS or linux.

Related to issue #806.

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 3, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@37dbbdb). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #944   +/-   ##
=========================================
  Coverage          ?   94.65%           
=========================================
  Files             ?       45           
  Lines             ?     6623           
  Branches          ?        0           
=========================================
  Hits              ?     6269           
  Misses            ?      354           
  Partials          ?        0
Impacted Files Coverage Δ
joblib/test/test_parallel.py 96.04% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37dbbdb...5cd1bfe. Read the comment docs.

@ogrisel
Copy link
Copy Markdown
Contributor

ogrisel commented Oct 4, 2019

Thanks @albertcthomas . I have extended your test to make it even more interesting. It's really nice that the POSIX semantics are such that the test pass out-of-the box on Linux and macOS.

Still we will have to rework the temporary file collection to have it work on windows as well. I have to think more about it but unfortunately I won't have time to work on it today. Maybe next week hopefully.

@albertcthomas
Copy link
Copy Markdown
Contributor Author

And the test fails for both loky and multiprocessing, showing that this error is indeed somewhat different to the one exposed in #942

I have extended your test to make it even more interesting. It's really nice that the POSIX semantics are such that the test pass out-of-the box on Linux and macOS.

And the views returned to the parent process are indeed memmaps.
Isn't it a bit "dangerous" to have a view being returned by default without the users being aware of it? (as memmapping is turned on by default for large data sets)

@ogrisel
Copy link
Copy Markdown
Contributor

ogrisel commented Oct 4, 2019

Isn't it a bit "dangerous" to have a view being returned by default without the users being aware of it? (as memmapping is turned on by default for large data sets)

Why? If you write the same code using the threading backend you would also have shared memory.

@albertcthomas
Copy link
Copy Markdown
Contributor Author

Why? If you write the same code using the threading backend you would also have shared memory.

True :).

@ogrisel
Copy link
Copy Markdown
Contributor

ogrisel commented Mar 11, 2020

The solution being implemented in #966 would make it such that a Parallel function calls that returns values that are views of tempory memmapped arrays automatically created by joblib from the input argument will always be materialized back as regular numpy arrays.

@ogrisel
Copy link
Copy Markdown
Contributor

ogrisel commented May 15, 2020

Fixed and released in 0.15.0.

@ogrisel ogrisel closed this May 15, 2020
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.

2 participants