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

Unable to delete temporary DLL on Windows due to AccessViolationException #5

Closed
phrack opened this issue Aug 15, 2016 · 8 comments
Closed
Labels

Comments

@phrack
Copy link

phrack commented Aug 15, 2016

This issue is alive and well on every version of Windows: PatternConsulting#10.

@vonnieda
Copy link
Member

If someone can come up with working fix for this, I'd be happy to integrate it :) Otherwise it will take a while until I can find some time to do this work on Windows.

@phrack
Copy link
Author

phrack commented Aug 15, 2016

My project can probably spend some time on a PR for this since it's really annoying for our users. Packaging binaries for Windows/Linux/Mac less so.

@vonnieda
Copy link
Member

That would be awesome! I am planning to work on new binaries soon - just swamped with a cross country move right now and don't have time.

@phrack
Copy link
Author

phrack commented Aug 15, 2016

I just did that two weeks ago. I understand. I will check into OpenCV 3.1 stability too.

@phrack
Copy link
Author

phrack commented Aug 18, 2016

I've done a little bit of experimenting here and using a custom classloader that will get garbage collected, as the other repo issue suggests, just isn't going to be reliable. You can't guarantee when the garbage collector will actually run even with System.gc or how extensive the collection will be. In fact, System.gc, which is the only real illusion of control over garbage collection, doesn't even have to be implemented by a JVM.

I am going to propose a formalization of a solution I use in my project that uses this OpenCV package:

  1. On Windows, prepend the folder created to hold the OpenCV binaries with opencv_ so that it's easy to find.
  2. On Windows, do not try to delete the folder on shutdown.
  3. On Windows, on startup look for folders that start with opencv_ and try to delete them otherwise the drive fills up with temporary OpenCV instances. If the delete fails, log it but move on without an exception. Failure to delete could simply mean another application on the same system is using the library.

vonnieda added a commit that referenced this issue Aug 22, 2016
Fix #5 by cleaning old opencv instances on start on Windows
vonnieda added a commit that referenced this issue Aug 22, 2016
* develop:
  Release of 2.4.13-0
  Fix #5 by cleaning old opencv instances on start on Windows
  Add bundle plugin and packaging
@vonnieda
Copy link
Member

Note: The JNA loader does something similar, but takes it a step further by adding a marker indicating which file should be deleted. I like this method and we should adopt it: https://github.com/java-native-access/jna/blob/master/src/com/sun/jna/Native.java#L1192

@mgineer85
Copy link

hi, just looked through the project and found an commit addressing the isse described here and I in openpnp/#699:
4697860#diff-cc2450ddb977c98e67b0eaa70c4aaa92R372

the commit was merged but I can't find the code in the local copy my eclipse is using. why is this?
unbenannt
this error prevents the junit-tests on windows to fail and abort early ...

@vonnieda
Copy link
Member

Believe this was fixed in #9. If still experiencing please reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants