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

OpenCV examples crash #148

Closed
AndersonTaylor opened this issue Nov 15, 2014 · 10 comments · Fixed by #150
Closed

OpenCV examples crash #148

AndersonTaylor opened this issue Nov 15, 2014 · 10 comments · Fixed by #150

Comments

@AndersonTaylor
Copy link

When I try to build either of the /examples for Open CV, I get the following warnings:

../../go-opencv/opencv/opencv.c:26:21: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:37:38: note: passing argument to parameter 'p0' here
../../go-opencv/opencv/opencv.c:26:36: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:37:48: note: passing argument to parameter 'p1' here
../../go-opencv/opencv/opencv.c:62:18: warning: passing 'schar *' (aka 'signed char *') to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
../../go-opencv/opencv/highgui.go:39:35: note: passing argument to parameter 'p0' here

Then when I run them they open the window and then will crash within a minute.

I get the following:

runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort

(and a dump of a bunch of goroutine traces)

Any idea what's going on?
Running on Mac OSX 10.10

@AndersonTaylor
Copy link
Author

go install github.com/hybridgroup/gobot/platforms/opencv

seems to have stopped the warnings. But still getting the crashes.

@zankich
Copy link
Contributor

zankich commented Nov 15, 2014

@AndersonTaylor Can you please include the entire stack trace, thanks!

@AndersonTaylor
Copy link
Author

examples anderson$ ./opencv_window
2014/11/15 11:15:57 Initializing Robot cameraBot ...
2014/11/15 11:15:57 Initializing devices...
2014/11/15 11:15:57 Initializing device window ...
2014/11/15 11:15:57 Initializing device camera ...
2014/11/15 11:15:57 Starting Robot cameraBot ...
2014/11/15 11:15:57 Starting connections...
2014/11/15 11:15:57 Starting devices...
2014/11/15 11:15:57 Starting device window...
2014/11/15 11:15:57 Starting device camera...
2014/11/15 11:16:01 Starting work...
runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x7fff87e23282

goroutine 0 [idle]:

goroutine 16 [chan receive]:
github.com/hybridgroup/gobot.(*Gobot).Start(0xc20803e040)
    /Users/anderson/go/src/github.com/hybridgroup/gobot/gobot.go:68 +0x8f
main.main()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/examples/opencv_window.go:28 +0x39c

goroutine 19 [finalizer wait]:
runtime.park(0x4016030, 0x421f3c0, 0x4202269)
    /usr/local/go/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x421f3c0, 0x4202269)
    /usr/local/go/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
    /usr/local/go/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall]:
os/signal.loop()
    /usr/local/go/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
    /usr/local/go/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 17 [syscall]:
runtime.goexit()
    /usr/local/go/src/pkg/runtime/proc.c:1445

goroutine 21 [chan receive]:
github.com/hybridgroup/gobot.(*Event).Read(0xc20803e080)
    /Users/anderson/go/src/github.com/hybridgroup/gobot/event.go:37 +0x6d
github.com/hybridgroup/gobot.func·001()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/event.go:21 +0x33
created by github.com/hybridgroup/gobot.NewEvent
    /Users/anderson/go/src/github.com/hybridgroup/gobot/event.go:23 +0xe2

goroutine 23 [chan receive]:
github.com/hybridgroup/gobot.func·011()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/utils.go:17 +0x4e
created by github.com/hybridgroup/gobot.Every
    /Users/anderson/go/src/github.com/hybridgroup/gobot/utils.go:20 +0x9e

goroutine 753 [syscall]:
github.com/hybridgroup/go-opencv/opencv._Cfunc_cvGrabFrame(0x7823990, 0x0)
    github.com/hybridgroup/go-opencv/opencv/_obj/_cgo_defun.c:548 +0x31
github.com/hybridgroup/go-opencv/opencv.(*Capture).GrabFrame(0x7823990, 0x0)
    /Users/anderson/go/src/github.com/hybridgroup/go-opencv/opencv/highgui.go:486 +0x27
github.com/hybridgroup/gobot/platforms/opencv.func·002()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/platforms/opencv/camera_driver.go:46 +0x4b
created by github.com/hybridgroup/gobot.func·011
    /Users/anderson/go/src/github.com/hybridgroup/gobot/utils.go:18 +0x5e


goroutine 1699 [syscall]:
github.com/hybridgroup/go-opencv/opencv._Cfunc_cvGrabFrame(0x7823990, 0x4035caa)
    github.com/hybridgroup/go-opencv/opencv/_obj/_cgo_defun.c:548 +0x31
github.com/hybridgroup/go-opencv/opencv.(*Capture).GrabFrame(0x7823990, 0x5310768)
    /Users/anderson/go/src/github.com/hybridgroup/go-opencv/opencv/highgui.go:486 +0x27
github.com/hybridgroup/gobot/platforms/opencv.func·002()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/platforms/opencv/camera_driver.go:46 +0x4b
created by github.com/hybridgroup/gobot.func·011
    /Users/anderson/go/src/github.com/hybridgroup/gobot/utils.go:18 +0x5e

goroutine 2756 [runnable]:
github.com/hybridgroup/go-opencv/opencv._Cfunc_cvShowImage(0x5600020, 0x7834020)
    github.com/hybridgroup/go-opencv/opencv/_obj/_cgo_defun.c:998 +0x31
github.com/hybridgroup/go-opencv/opencv.(*Window).ShowImage(0xc208078180, 0x7834020)
    /Users/anderson/go/src/github.com/hybridgroup/go-opencv/opencv/highgui.go:136 +0x39
github.com/hybridgroup/gobot/platforms/opencv.(*WindowDriver).ShowImage(0xc20802a0e0, 0x7834020)
    /Users/anderson/go/src/github.com/hybridgroup/gobot/platforms/opencv/window_driver.go:43 +0x4a
main.func·001(0x412c140, 0x7834020)
    /Users/anderson/go/src/github.com/hybridgroup/gobot/examples/opencv_window.go:17 +0x5e
created by github.com/hybridgroup/gobot.(*Event).Read
    /Users/anderson/go/src/github.com/hybridgroup/gobot/event.go:40 +0x165

goroutine 819 [runnable]:
github.com/hybridgroup/go-opencv/opencv._Cfunc_cvGrabFrame(0x7823990, 0x1)
    github.com/hybridgroup/go-opencv/opencv/_obj/_cgo_defun.c:548 +0x31
github.com/hybridgroup/go-opencv/opencv.(*Capture).GrabFrame(0x7823990, 0x0)
    /Users/anderson/go/src/github.com/hybridgroup/go-opencv/opencv/highgui.go:486 +0x27
github.com/hybridgroup/gobot/platforms/opencv.func·002()
    /Users/anderson/go/src/github.com/hybridgroup/gobot/platforms/opencv/camera_driver.go:46 +0x4b
created by github.com/hybridgroup/gobot.func·011
    /Users/anderson/go/src/github.com/hybridgroup/gobot/utils.go:18 +0x5e



rax     0x0
rbx     0x6
rcx     0xb0080c38
rdx     0x0
rdi     0xa03
rsi     0x6
rbp     0xb0080c60
rsp     0xb0080c38
r8      0xb0080b40
r9      0xb0081000
r10     0x8000000
r11     0x206
r12     0x7fff77e3c070
r13     0xcc51c6b9070
r14     0xb0081000
r15     0xb0080cb8
rip     0x7fff87e23282
rflags  0x206
cs      0x7
fs      0x0
gs      0x0

@AndersonTaylor
Copy link
Author

That's the gist. It was too long for Github.
Goroutines like goroutine 753 appeared 1760 times
and ones like goroutine 1699 appeared 255 times.

Here's the full thing:

https://www.dropbox.com/s/4wyhmicqsfjoew5/gobot_stacks.txt?dl=0

@zankich
Copy link
Contributor

zankich commented Nov 16, 2014

@AndersonTaylor I pushed a potential fix to the branch https://github.com/hybridgroup/gobot/tree/gh-148, can you please verify that fixes your issue?

@AndersonTaylor
Copy link
Author

Unfortunately no, it still seems to do the same thing.
Usually crashes about 15 seconds after the video window opens.

Full trace:
https://www.dropbox.com/s/1alys6apvkdj43k/gobot_stacks2.txt?dl=0

@zankich
Copy link
Contributor

zankich commented Nov 17, 2014

@AndersonTaylor from your stack trace I don't think you're building against the new branch with the fix.

You need to

$ cd $GOPATH/src/github.com/hybridgroup/gobot
$ git fetch
$ git checkout gh-148
$ go build -a github.com/hybridgroup/gobot/platforms/opencv
$ go run examples/opencv_window.go

@AndersonTaylor
Copy link
Author

My bad!! That's what I get for trying to have two separate GOPATHs.

Yes, that seems to have solved the problem. Thanks for the quick response!

@zankich
Copy link
Contributor

zankich commented Nov 17, 2014

@AndersonTaylor fantastic, I'll cut a new release with this fix

deadprogram added a commit that referenced this issue Nov 17, 2014
Fix unnecessary goroutine creation
@zankich
Copy link
Contributor

zankich commented Nov 17, 2014

@AndersonTaylor this fix has been merged and Gobot 0.7.1 has been released

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

Successfully merging a pull request may close this issue.

2 participants