Closed james-e-morris closed 3 years ago
Hi Morrious, Thank you for your feedback. We are reviewing the feasibility of your request to have "run( ) process exit" when any of the sub-processes has crashed. Let us come back to you in one to two days.
Thanks KC Yee
Thank you, KC. This issue is more important than the GPIO one I would say. I am currently having a problem where the PiFaceCam functionality stops responding after a few days, so I would like to be able to reinitialize when something has crashed. I plan to set it up as a constantly running service, but as it works right now that service would just freeze without knowing it has partially stopped.
Hi Morrious, From the example in your first message, we believe the error occurred because the port for video streaming was locked when the earlier streaming was interrupted and not immediately available when you restart PiFaceCam. We also understand that this is not the only problem you have encountered, and more importantly, the run() process does not return when these occur. We planned to make the following improvements to address them. 1) We will add a function to detect exceptions in each process and log them. 2) Trigger all running sub-processes to properly close and run() to return when an exception is detected. We have been running some tests and these seem to be doable. We should have a running code in a week time. However, we will not able to upload it to pypi.org immediately as to do this, we will have to run many more tests and this will take weeks. If you prefer, we can upload the code to github for you to use/test first, once it is available (estimated by early next week).
@tensorfactory thank you! Yes please, I would gladly test with the code via GitHub in the meantime.
Hi Morrious, We have uploaded pifacecam-1.1.1a1 to the pre-releases folder. It has the following upgrades.
1) Add an option to disable status/shutdown gpios by setting the value to -1. 2) When an exception is encountered, the run() method will return an integer indicating the reason of return when exception encountered. More information on exceptions can be obtained in the log file. (Note: From exception trigger to run() return will take around 5 to 10seconds as it has to wait for all running processes to properly close.)
SHUTDOWN_PIN_TRIGGERED = 1 ERROR_ENCOUNTERED_WHILE_READING_USB_CAMERA = 2 USB_CAMERA_IS_REQUIRED_BUT_NOT_AVAILABLE = 3 ERROR_ENCOUNTERED_WHILE_READING_PICAMERA = 4 PICAMERA_IS_REQUIRED_BUT_NOT_AVAILABLE = 5 ERROR_ENCOUNTERED_WHILE_PROCESSING_EMBEDDING = 6 ERROR_ENCOUNTERED_IN_CALLBACK_FUNCTION = 7 ERROR_ENCOUNTERED_WHILE_SETTING_UP_VIDEO_STREAMING_SERVER = 8 ERROR_ENCOUNTERED_WHILE_SETTING_UP_STATUS_SHUTDOWN_GPIOS = 9 ERROR_ENCOUNTERED_WHILE_SETTING_UP_VERIFICATION_SERVER = 10
Hope this will resolve those issues you encountered. Kindly help to test and feedback.
Rgds KC Yee
Great, thank you so much! I will integrate the pre-release into my application and let you know if I have any issues.
I'm getting an error when I try to install this pre-release version. I've tried installing using the --upgrade tag as well as a full uninstall and reinstall.
Hi Morrious, Can you try "wget https://github.com/tensorfactory/PiFaceCam/raw/master/pre-releases/pifacecam-1.1.1a1-cp37-abi3-linux_armv7l.whl" ? Once downloaded the whl file size should be around 67.3 MB.
Rgds KC Yee
That did the trick, thank you. I guess the Copy Permalink button isn't the correct wget link.
I have been testing all afternoon with the prerelease and it looks to be working well. The return codes are working and I have the pins set to -1 without any errors. Thanks for the updates!
Thank you Morrious for your valuable feedbacks.
PiFaceCam launches many parallel processes and sometimes these processes end, but the main PiFaceCam process is still active. My application has no way of knowing if PiFaceCam is actually still functional if the run( ) process is still active.
Below is a simple example of this. If I run PiFaceCam too soon after ending it while streaming to the browser, sometimes the videa stream thread crashes right away. When this happens, the run( ) call should error out, so I should at least be able to check the status of the full PiFaceCam call stack.
test code:
console output indicating the process failed, but the run( ) code is still operating: