Skip to content

Bug fix: go_objects should be able to implement interfaces #5

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

atishnazir
Copy link
Contributor

There was a tiny typo that meant class data was not attached to the interface callback objects.

When constructing Go Objects that implement one or more interfaces this would result in a nil pointer exception within goInterfaceInit.

Discovered whilst using go-gst:

  gst.RegisterElement(
    plugin,
    elementName,
    gst.RankNone,
    &httpSrc,
    base.ExtendsBaseSrc,
    gst.InterfaceURIHandler,
  )

There was a tiny typo that meant class data was not attached to the interface callback objects.

When constructing Go Objects that implement one or more interfaces this would result in a nil pointer exception within goInterfaceInit.

Discovered whilst using go-gst:

```
  gst.RegisterElement(
    plugin,
    elementName,
    gst.RankNone,
    &httpSrc,
    base.ExtendsBaseSrc,
    gst.InterfaceURIHandler,
  )
```
@atishnazir
Copy link
Contributor Author

atishnazir commented Aug 18, 2021

I think this PR needs something extra, works fine through a debugger but at full speed there's a hiccough:

=== RUN   TestGstreamer
Running Suite: Pipelines/Gstreamer Suite
========================================
Random Seed: 1629269532
Will run 2 of 32 specs

time="2021-08-18T07:52:12+01:00" level=info msg="GStreamer MediaBackend"
SSSSSSSSSSSSSSSSSfatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7f0246add747]

runtime stack:
runtime.throw(0x920ebf, 0x2a)
	/home/na/sdk/go1.16.4/src/runtime/panic.go:1117 +0x72
runtime.sigpanic()
	/home/na/sdk/go1.16.4/src/runtime/signal_unix.go:718 +0x2e5

goroutine 6 [syscall, locked to thread]:
runtime.cgocall(0x7ff350, 0xc0001ea918, 0xcdce00)
	/home/na/sdk/go1.16.4/src/runtime/cgocall.go:154 +0x5b fp=0xc0001ea8e8 sp=0xc0001ea8b0 pc=0x448d9b
github.com/tinyzimmer/go-gst/gst._Cfunc_gst_element_register(0x7f0200173c40, 0x7f0200000ec0, 0x0, 0x7f02001b9a10, 0x0)
	_cgo_gotypes.go:7322 +0x48 fp=0xc0001ea918 sp=0xc0001ea8e8 pc=0x5f7c28
github.com/tinyzimmer/go-gst/gst.RegisterElement.func1(0xc0003ae050, 0x910e93, 0xc, 0x0, 0x99b360, 0xc00039e078, 0x99f970, 0xcab900, 0xc0001eaa60, 0x1, ...)
	/home/na/go/pkg/mod/github.com/cognitive-i/go-gst@v0.2.30-goobject-bugfix/gst/gst_element.go:103 +0x145 fp=0xc0001ea990 sp=0xc0001ea918 pc=0x6127c5
github.com/tinyzimmer/go-gst/gst.RegisterElement(0xc0003ae050, 0x910e93, 0xc, 0x0, 0x99b360, 0xc00039e078, 0x99f970, 0xcab900, 0xc0001eaa60, 0x1, ...)
	/home/na/go/pkg/mod/github.com/cognitive-i/go-gst@v0.2.30-goobject-bugfix/gst/gst_element.go:103 +0xae fp=0xc0001eaa00 sp=0xc0001ea990 pc=0x602b8e
eng.atxnetworks.com/vada/ronin/pipelines/gstreamer.httpFactoryFn(0xc0003ae050, 0xc0003ae050)
	/home/na/workspace/redacted/gstHttpSource.go:18 +0xca fp=0xc0001eaa80 sp=0xc0001eaa00 pc=0x78726a
github.com/tinyzimmer/go-gst/gst.goPluginInit(0x7f0200173c40, 0x7f02001b9870, 0x0)
	/home/na/go/pkg/mod/github.com/cognitive-i/go-gst@v0.2.30-goobject-bugfix/gst/cgo_exports.go:239 +0x142 fp=0xc0001eaae0 sp=0xc0001eaa80 pc=0x5ffbe2
_cgoexp_9fe65b6dd3a1_goPluginInit(0x7f0207ffeb10)
	_cgo_gotypes.go:17429 +0x37 fp=0xc0001eab08 sp=0xc0001eaae0 pc=0x61b497
runtime.cgocallbackg1(0x61b460, 0x7f0207ffeb10, 0x0)
	/home/na/sdk/go1.16.4/src/runtime/cgocall.go:292 +0x18c fp=0xc0001eaba8 sp=0xc0001eab08 pc=0x44914c
runtime.cgocallbackg(0x61b460, 0x7f0207ffeb10, 0x0)
	/home/na/sdk/go1.16.4/src/runtime/cgocall.go:228 +0xda fp=0xc0001eac18 sp=0xc0001eaba8 pc=0x448f1a
runtime.cgocallback(0x448dbf, 0x803cf0, 0xc0001eacb0)
	/home/na/sdk/go1.16.4/src/runtime/asm_amd64.s:788 +0xa9 fp=0xc0001eac40 sp=0xc0001eac18 pc=0x4b74e9
runtime.asmcgocall(0x803cf0, 0xc0001eacb0)
	/home/na/sdk/go1.16.4/src/runtime/asm_amd64.s:652 +0x42 fp=0xc0001eac48 sp=0xc0001eac40 pc=0x4b73c2
runtime.cgocall(0x803cf0, 0xc0001eacb0, 0x8114f0)
	/home/na/sdk/go1.16.4/src/runtime/cgocall.go:164 +0x7f fp=0xc0001eac80 sp=0xc0001eac48 pc=0x448dbf
github.com/tinyzimmer/go-gst/gst._Cfunc_gst_plugin_register_static_full(0x1200000001, 0x7f0200000ee0, 0x7f02001a6c00, 0x803a40, 0x7f0200000cf0, 0x7f0200000d10, 0x7f0200000d30, 0x7f02001a2850, 0x7f02001b9100, 0x7f02001b9870, ...)
	_cgo_gotypes.go:11765 +0x4b fp=0xc0001eacb0 sp=0xc0001eac80 pc=0x5fa96b
github.com/tinyzimmer/go-gst/gst.RegisterPlugin.func2(0xc0001eae28, 0x7f0200000ee0, 0x7f02001a6c00, 0x7f0200000cf0, 0x7f0200000d10, 0x7f0200000d30, 0x7f02001a2850, 0x7f02001b9100, 0x7f02001b9870, 0xc0001ead90)
	/home/na/go/pkg/mod/github.com/cognitive-i/go-gst@v0.2.30-goobject-bugfix/gst/gst_plugin.go:150 +0xf3 fp=0xc0001ead30 sp=0xc0001eacb0 pc=0x6199b3
github.com/tinyzimmer/go-gst/gst.RegisterPlugin(0xc0001eae28, 0x930f48, 0xc0003c0000)

@tinyzimmer
Copy link
Owner

Hey sorry I've had a busy month and just seeing this for the first time. That functionality is very experimental and definitely will have bugs like this. I can take a look at what you've proposed so far at some point and try to help it along.

@atishnazir
Copy link
Contributor Author

No worries, I've not a had a chance to tinker recently as was on holiday. WIth a view to easily reproduce the issue I've crafted a static plugin example here: https://github.com/cognitive-i/go-gst/commits/bugfix/plugins-with-interfaces

In the process I added NewElementFromUri functionality.

Of course now that I've created a standalone pseudo test case, the stray is no longer reproducing. Will bash it a little more.

@RSWilli
Copy link

RSWilli commented Aug 24, 2023

@atishnazir please move this PR to https://github.com/go-gst/go-glib (where future development of the bindings will take place)

@atishnazir
Copy link
Contributor Author

@RSWilli I haven't looked this one in a while as I was never satisfied I fully understood the issue. Will have a gander over next few days and either close/transfer as appropriate. @tinyzimmer, thanks for your work and @RSWilli thanks for picking up!

@RSWilli
Copy link

RSWilli commented Aug 25, 2023

@atishnazir FYI the original author is still on board, but is currently very busy

we are using the new org to create a bigger community around this project

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 this pull request may close these issues.

3 participants