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

FrontalFaceDetector cause MemoryCorruptionException in multithread usage #200

Open
matteofabbri opened this issue Apr 4, 2022 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@matteofabbri
Copy link

  • implement a code that find face
  • invoke the code with a big bunch of different threads
  • Fatal MemoryCorruptionExecption, process die and there is no way to recover
@takuya-takeuchi
Copy link
Owner

@matteofabbri
You can not share FRDN instance between threads.
So you must

  • Create some FaceRecognition instance
  • Use multiprocess

@takuya-takeuchi takuya-takeuchi self-assigned this Apr 5, 2022
@takuya-takeuchi takuya-takeuchi added the question Further information is requested label Apr 5, 2022
@matteofabbri
Copy link
Author

@takuya-takeuchi if you take a look at my PR i fixed the issue.
Making different issues dont fix the problem, due to DlibDotNet internal issues.
ASAP i will fix other not thredsafe components

@takuya-takeuchi
Copy link
Owner

You may be able to avoid excpetion for FaceLocation but other function may face to same issue.
Should we generate internal instance when function is invoked every time?
I guess it is not good.

@matteofabbri
Copy link
Author

In the path of detecting faces, extracting encodings and recognize a subject in those encoding there are no other thread unsafe regions.
Unless you select a different kind of faceselector that i will try to fix asap.
On the test i runned, the whole path takes more that 24seconds for serving a thread using the lock to access the FRDN and 400ms with the fix that i applied

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

No branches or pull requests

2 participants