{"action":"created","issue":{"url":"https://api.github.com/repos/lazywei/go-opencv/issues/43","labels_url":"https://api.github.com/repos/lazywei/go-opencv/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/lazywei/go-opencv/issues/43/comments","events_url":"https://api.github.com/repos/lazywei/go-opencv/issues/43/events","html_url":"https://github.com/lazywei/go-opencv/issues/43","id":56197786,"number":43,"title":"Crashes/Panics at cvHaarDetectObjects","user":{"login":"bryancallahan","id":2325847,"avatar_url":"https://avatars.githubusercontent.com/u/2325847?v=3","gravatar_id":"","url":"https://api.github.com/users/bryancallahan","html_url":"https://github.com/bryancallahan","followers_url":"https://api.github.com/users/bryancallahan/followers","following_url":"https://api.github.com/users/bryancallahan/following{/other_user}","gists_url":"https://api.github.com/users/bryancallahan/gists{/gist_id}","starred_url":"https://api.github.com/users/bryancallahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryancallahan/subscriptions","organizations_url":"https://api.github.com/users/bryancallahan/orgs","repos_url":"https://api.github.com/users/bryancallahan/repos","events_url":"https://api.github.com/users/bryancallahan/events{/privacy}","received_events_url":"https://api.github.com/users/bryancallahan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-02T05:31:03Z","updated_at":"2015-02-04T02:37:57Z","closed_at":"2015-02-04T02:37:57Z","body":"I've been running into this stack consistently while running detection over a network. I basically have a `http.ListenAndServe` interface sitting in-front of go-opencv. I see this stack on Ubuntu 14.04 LTS via `apt-get install libopencv-dev` (\"libopencv-dev: Installed: 2.4.8+dfsg1-2ubuntu1\") and via fresh community build of opencv-2.4.10. Built with go 1.4. So far not seeing this issue with opencv-2.4.10, go 1.4, built on OSX 10.9.5. It seems like it's just something in ubuntu. =/\r\n\r\nAny ideas of what I could look into? Also are there any suggestions on how best to recover from this (and related situations) so my app doesn't just panic and crash?\r\n\r\n```\r\nfatal error: unexpected signal during runtime execution\r\n[signal 0xb code=0x1 addr=0x2f85e40 pc=0x7f3230948c39]\r\n\r\nruntime stack:\r\nruntime.gothrow(0x8b0610, 0x2a)\r\n\t/usr/local/go/src/runtime/panic.go:503 +0x8e\r\nruntime.sigpanic()\r\n\t/usr/local/go/src/runtime/sigpanic_unix.go:14 +0x5e\r\n\r\ngoroutine 6 [syscall, locked to thread]:\r\nruntime.cgocall_errno(0x4084d0, 0xc2080b5628, 0x401c000000000000)\r\n\t/usr/local/go/src/runtime/cgocall.go:130 +0xf5 fp=0xc2080b5608 sp=0xc2080b55e0\r\ngithub.com/lazywei/go-opencv/opencv._Cfunc_cvHaarDetectObjects(0x2b2a950, 0x2a75ba0, 0x7f32200eb070, 0x3ff199999999999a, 0x100000003, 0x0, 0x0, 0x0)\r\n\t/var/lib/jenkins/jobs/project/workspace/go/src/github.com/lazywei/go-opencv/opencv/:599 +0x44 fp=0xc2080b5628 sp=0xc2080b5608\r\ngithub.com/lazywei/go-opencv/opencv.(*HaarCascade).DetectObjects(0xc20802c070, 0x2b2a950, 0x0, 0x0, 0x0)\r\n\t/var/lib/jenkins/jobs/project/workspace/go/src/github.com/lazywei/go-opencv/opencv/cvaux.go:67 +0x105 fp=0xc2080b56d8 sp=0xc2080b5628\r\n...\r\n```\r\n\r\nPlease let me know what things I could test or provide to help debugging.\r\n\r\nThanks for any help or insights!\r\n\r\nUpdate 2/3/2015: This might be due to the fact that I'm holding a `opencv.LoadHaarClassifierCascade` globally in order to speed up detection. The cascade stays the same throughout the lifetime of the app so I'd like to avoid running `LoadHaarClassifierCascade` on each request. But if this is getting cleaned up then I could see getting a panic. Weird that it doesn't clean up on OSX (or if it does I don't run into this issue). I have also confirmed that I'm seeing this on CentOS 7.0 OpenLogic. =/"},"comment":{"url":"https://api.github.com/repos/lazywei/go-opencv/issues/comments/72779959","html_url":"https://github.com/lazywei/go-opencv/issues/43#issuecomment-72779959","issue_url":"https://api.github.com/repos/lazywei/go-opencv/issues/43","id":72779959,"user":{"login":"bryancallahan","id":2325847,"avatar_url":"https://avatars.githubusercontent.com/u/2325847?v=3","gravatar_id":"","url":"https://api.github.com/users/bryancallahan","html_url":"https://github.com/bryancallahan","followers_url":"https://api.github.com/users/bryancallahan/followers","following_url":"https://api.github.com/users/bryancallahan/following{/other_user}","gists_url":"https://api.github.com/users/bryancallahan/gists{/gist_id}","starred_url":"https://api.github.com/users/bryancallahan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryancallahan/subscriptions","organizations_url":"https://api.github.com/users/bryancallahan/orgs","repos_url":"https://api.github.com/users/bryancallahan/repos","events_url":"https://api.github.com/users/bryancallahan/events{/privacy}","received_events_url":"https://api.github.com/users/bryancallahan/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T02:37:57Z","updated_at":"2015-02-04T02:37:57Z","body":"Ah, I think I finally found my issue. It seems to be having the cascade as a global variable as described in this question at stack overflow: http://stackoverflow.com/questions/25775650/golang-async-face-detection. So for now, I'll close up this issue."}}