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

Live crash on Mac OS #3

Open
chrisbenseler opened this issue Nov 25, 2019 · 1 comment
Open

Live crash on Mac OS #3

chrisbenseler opened this issue Nov 25, 2019 · 1 comment

Comments

@chrisbenseler
Copy link

When trying to use the live feature, the video does not open and the app crashes. On a MacOS (10.14.5)

The log outputs:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'

Any idea?

@tamerthamoqa
Copy link
Owner

tamerthamoqa commented Nov 27, 2019

Hi chrisbenseler,

It is a weird issue since I did not face this with Ubuntu 18.04 and Windows 10, it seems cv2.VideoCapture() follows the same logic as cv2.imshow() like in the github issue here:
opencv/opencv-python#134

It seems these calls must be from the main thread only and flask (or waitress in this case) creates a thread per each request which causes this issue, I suppose disallowing threaded mode would fix the issue.

Changing the serve() command to include the parameter 'threads=0' or 'threads=1' (not sure which) might solve the issue:
https://docs.pylonsproject.org/projects/waitress/en/stable/arguments.html

Or replacing the waitress.serve() with the flask app.run() method with parameter 'threaded=False' might work.

I will try to install a MacOS virtual machine soon and try to help but I can't promise anything as I am currently having a bit of a workload.

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

No branches or pull requests

2 participants