Skip to content

Prevent paket holding locks on assemblies during binding redirects - #1480

Merged
forki merged 1 commit into
fsprojects:masterfrom
haraldsteinlechner:Branch_2.48.2
Feb 29, 2016
Merged

forki merged 1 commit into
fsprojects:masterfrom
haraldsteinlechner:Branch_2.48.2

Conversation

@haraldsteinlechner

Copy link
Copy Markdown
Contributor

solves issue #1477

@isaacabraham isaacabraham changed the title ReflectionOnlyLaodFrom(file) holds on to assembly fix ReflectionOnlyLoadFrom(file) holds on to assembly fix Feb 17, 2016
@isaacabraham isaacabraham changed the title ReflectionOnlyLoadFrom(file) holds on to assembly fix Prevent paket holding locks on assemblies during binding redirects Feb 17, 2016
@forki

forki commented Feb 18, 2016

Copy link
Copy Markdown
Member

@haraldsteinlechner @isaacabraham is this good to go?

@forki

forki commented Feb 18, 2016

Copy link
Copy Markdown
Member

What do we need from the assembly? We have a assembly meta data reader here in paket that doesn't load the assembly at all.

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

imo my commit would be good to go.
The only problem i could imagine is performance.
I'd recommend to merge the commit now, but leave the issue open and look for another option instead of loading the assembly.

@isaacabraham

Copy link
Copy Markdown
Contributor

@forki it was to get assembly version and the signed key (if it exists). We never had the metadata reader at the time of the BR code so if that can also get these attributes maybe it would be better to replace this PR with one that uses that instead?

In the interim this code looks like it should be fine (although I haven't tested it myself) - it's just an alternative way of loading data on the assembly. The fact that it has to load the entire assembly into memory first could have some implications in terms of memory though?

forki added a commit that referenced this pull request Feb 29, 2016
Prevent paket holding locks on assemblies during binding redirects
@forki
forki merged commit c45a78c into fsprojects:master Feb 29, 2016
@forki

forki commented Feb 29, 2016

Copy link
Copy Markdown
Member

mhm merging this broke couple of releated integration tests. not sure why the build was green.

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

hmmm. crazy. also for my build all worked fine. checking again

@forki

forki commented Feb 29, 2016

Copy link
Copy Markdown
Member

It's 4 integration tests. And if I revert your commit they are working
again.
On Feb 29, 2016 10:58, "Harald Steinlechner" [email protected]
wrote:

hmmm. crazy. also for my build all worked fine. checking again

—
Reply to this email directly or view it on GitHub
#1480 (comment).

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

my initial commit was green because it only ran on travis i suppose

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

ok. i failed in finding a good, fast and robust solution to this problem.

  1. Loading assemblies in the default AppDomain always locks the file.
  2. We could use a fresh appdomain for loading and unloading those assemblies. However, using appdomains to do this is not straightforward (especially since passing data around requires serialization etc)
  3. We could use mono.ceceil for loading assembly metadata, but i suppose this is problematic as well (additional dependency)-

I don't know why there is a difference between mono and .net but one thing i know for sure: assembly binding semantcis is subtle and danger zone.

So, fixing our windows build (and appveyor CI), is not that simple. Revert and look for another solution not involving assembly loading (which is also SLOOW)?

@isaacabraham

Copy link
Copy Markdown
Contributor

Also AppDomains are dead in CoreCLR world.

@forki

forki commented Feb 29, 2016

Copy link
Copy Markdown
Member

Ok I will try to use the meta data reader that came from the F# compiler
itself. We already use it for pack.
On Feb 29, 2016 14:10, "Isaac Abraham" [email protected] wrote:

Also AppDomains are dead in CoreCLR world.

—
Reply to this email directly or view it on GitHub
#1480 (comment).

@isaacabraham

Copy link
Copy Markdown
Contributor

Sounds good. If we can rationalise this stuff to use a single mechanism that's a win.

forki added a commit that referenced this pull request Feb 29, 2016
@forki

forki commented Feb 29, 2016

Copy link
Copy Markdown
Member

Ok tried a different workaround in c57e735 - can please test with latest?

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

i also found a different workaround: haraldsteinlechner@777a415

the main problem was the caching of loaded libs

EDIT: yes will test after my build succeeds.

@forki

forki commented Feb 29, 2016

Copy link
Copy Markdown
Member

cool please send as PR

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

i updated my fix haraldsteinlechner@ce21a16

However, i did not send a pull request yet since i think your version is more robust when considering same assemblies with different versions etc. (my version builds on computing a key for assembly paths, yours uses more .net assembling binding resoution magic)

@haraldsteinlechner

Copy link
Copy Markdown
Contributor Author

i finally went with my solution, since i had some weired test errors (laziness in seq). i hope we can close down this boring thing.... (see my new PR, waiting for CI)

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