-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
"[./profiler.h:111] Thread state not found" when trying to profile openalpr #54
Comments
You may be right about coz missing thread creation, but the one other possibility is that openalpr is One other possibility is that something in a module-level constructor is accessing thread states before coz is fully initialized. I will look into this. |
[Charlie Curtsinger]
Not quite sure how to verify it, but running 'ltrace alpr ... 2>&1 | grep
Great. You can find the openalpr code using Happy hacking |
I investigated some more, and suspect the issue at hand is that threads are created before main() is called, in shared library initializers. Here is the gdb backtrace for the first call to pthread_create():
I guess coz need to hook into the program startup code a bit earlier than wrapped_main() is doing it. |
I was able to avoid the crash using the following patch:
The idea is to not depend on wrapped_main() being called to set up the state pointer. I suspect it is not a safe solution, but just wanted to let you know that it got rid of the crash. Unfortunately I did not get much information in the profile.coz file:
I suspect this is because I patched the wrong function in openalpr. |
Hi. Is there more debugging information I can provide to help you with this? |
I'm not sure there's a good way to fix this issue at the moment. My attempts to initialize the profiler in the replaced I'll have to put this issue on hold for a bit. |
Implementing #60 should fix this issue, although this feature is in very early stages. |
…nitialized. Make sure to initialize coz if pthread_create() is called before main(). Fixes issue plasma-umass#54
Make sure to initialize coz if pthread_create() is called before main(). This happend with openalpr when a shared library initialized a thread in the library initialization code. Fixes issue plasma-umass#54
To test coz-profiler, I decided to try to profile the openalpr command line tool, available from http://www.openalpr.com/ . It is a image processing system written in C++, used for extracting car license plates from images and video.
I modified the code like this to try benchmark how quickly it could process images.
After building, I ran it with a random MP4 vidoe file I had lying around after generating a simple openalpr.conf file:
Instead of getting a useful profiling run done, I got the error message "[./profiler.h:111] Thread state not found" instead. Am I using coz the wrong way?
Looking at the code, I suspect the problem is that openalpr is bootstraping its threads the wrong way, but I am unable to pinpoint exactly what is wrong. Also, I suspect coz should handle any code, and thus decided to report the problem as an issue.
The text was updated successfully, but these errors were encountered: