Re: [Patch] handle glib signals coming from different thread

Hi Sjoerd,

Sorry for late to reply.

But I noticed my mail server hasn’t receive the messages for few days.
If you have messages which I’ve not reply yet, ask me again.
And also I couldn’t send this message via my SMTP server.

I’ll ask this problem to my provider.


Your concept and patch seems good.
But I couldn’t crash your avtest unless your patch.

How can I reproduce your problem correctly?

On Wed, 5 Apr 2006 00:16:39 +0200

On Sat, Apr 08, 2006 at 09:28:08PM +0900, Masao M. wrote:

Your concept and patch seems good.
But I couldn’t crash your avtest unless your patch.

How can I reproduce your problem correctly?

Without my patch i always get ``stack level too deep
(SystemStackError)’’.
As it is a race condition it’s quite difficult to reliably reproduce it
though.

The attached version starts a ruby thread in a callback which makes the
program
segv. when run with an unpatches ruby-gnome2. Hopefully this will
trigger the
bug for you too.

Sjoerd

Hi,

On Mon, 10 Apr 2006 23:36:42 +0200
[email protected] (Sjoerd S.) wrote:

On Sat, Apr 08, 2006 at 09:28:08PM +0900, Masao M. wrote:

Your concept and patch seems good.
But I couldn’t crash your avtest unless your patch.

How can I reproduce your problem correctly?

Without my patch i always get ``stack level too deep (SystemStackError)‘’.
As it is a race condition it’s quite difficult to reliably reproduce it though.

The attached version starts a ruby thread in a callback which makes the program
segv. when run with an unpatches ruby-gnome2. Hopefully this will trigger the
bug for you too.

Hmm… On my environment, it doesn’t happen. The console shows like as:


[mutoh@linux]~% ruby avtest
playing the pipe: false


And then, nothing is happened.

My environment is:
Fedora Core 4
GTK±2.8.3
ruby 1.8.4 (2005-12-24) [i686-linux]
gstreamer-0.8.11

I may not build/install Ruby/GStreamer correctly.
So I’ll try to re-install gstreamer and some stuff and retry it
tomorrow.

But tell me if you have something to help me.


.:% Masao M.[email protected]


This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

On Tue, Apr 11, 2006 at 07:27:59PM +0200, Sjoerd S. wrote:

How can I reproduce your problem correctly?
Hmm… On my environment, it doesn’t happen. The console shows like as:
my original mail, sorry…
Don’t know why i didn’t think about it earlier. But using a videotestsrc
as a
src instead of a filesrc triggers it too. Makes it a lot less demanding
on your
installation to reproduce it.

Test attached :slight_smile:

Sjoerd

Five is a sufficiently close approximation to infinity.
– Robert Firth

“One, two, five.”
– Monty Python and the Holy Grail

On Wed, Apr 12, 2006 at 01:33:28AM +0900, Masao M. wrote:


[mutoh@linux]~% ruby avtest
playing the pipe: false


And then, nothing is happened.

Right you need to give it a movie as an argument :slight_smile: I didn’t mention
that in my
original mail, sorry…

Sjoerd

This place just isn’t big enough for all of us. We’ve got to find a way
off this planet.


This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

Hi Sjoerd,

Now, I and Kou investigate another serious bug on CVS.
New signal handler implementation may causes SEGV.
#It’s reported by Joao.

We’ll fix it, and try your patch again.

On Thu, 20 Apr 2006 00:59:18 +0200
Sjoerd S. [email protected] wrote:

Right you need to give it a movie as an argument :slight_smile: I didn’t mention that in
Five is a sufficiently close approximation to infinity.
– Robert Firth

“One, two, five.”
– Monty Python and the Holy Grail

.:% Masao M.[email protected]


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Hi Sjoerd,

On Thu, 20 Apr 2006 08:08:41 +0900
Masao M. [email protected] wrote:

Hi Sjoerd,

Now, I and Kou investigate another serious bug on CVS.
New signal handler implementation may causes SEGV.
#It’s reported by Joao.

We’ll fix it, and try your patch again.

Finally, kou fixed this problem.

So, I tried your patch and avtest.
But it’s occured segmentation fault yet.

I tried 2 patterns below:

  1. Your patch before kou fixed joao problems(0.14.1 base).
    → rbgobj_closure.c.0.14.1+

  2. Your patch applied against latest CVS(fixed joao problems).
    → rbgobj_closure.c.1

Both of them occurs segmentation fault.

Could you try them again?

  • Both are not patch but rbgobj_closure.c itself.
    Replace them to original rbgobj_closure.c.
  • Try latest CVS Ruby/GLib2.

Hi Masao,

  1. Your patch applied against latest CVS(fixed joao problems).

→ rbgobj_closure.c.1

I have been waiting for SourceForge to update to anonymous CVS
during all this time and it does not seem to be updated yet.

This is the latest updates that I get:

For file “ruby-gnome2/glib/ChangeLog”:
2006-03-18 Kouhei S. [email protected]

For file “ruby-gnome2/gtk/ChangeLog”:
2006-03-18 Kouhei S. [email protected]

And the web ViewCVS says:
*http://cvs.sourceforge.net/viewcvs.py/ruby-gnome2/#dirlist

*For file ChangeLog in
Ruby-GNOME 2 download | SourceForge.net :

ChangeLog 1.557 5 weeks ktou *
src/rbgtkaccelgroup.c:
Follow new GRClosure API. Call g_rclosure_attach.

Anyway, I will keep waiting for SourceForge to update the anonymous CVS.
I’m glad that Kouhei has been able to fix it. Cairo is fun:

That Chess Board uses Ruby-Cairo and Ruby-GNOME2. I still want some
pretty
pieces,
though. :slight_smile:

Thanks guys.

Cheers,
Joao

Hi,

On Fri, 28 Apr 2006 11:21:44 -0300
“Joao P.” [email protected] wrote:

Hi Masao,

  1. Your patch applied against latest CVS(fixed joao problems).

→ rbgobj_closure.c.1

I have been waiting for SourceForge to update to anonymous CVS
during all this time and it does not seem to be updated yet.

Wait for a moment, please.

And notice the fixes is not only rbgobj_closure.c
but also Ruby/GTK2.
So, You’ll update Ruby/GLib2 and Ruby/GTK2.


.:% Masao M.[email protected]


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

On Fri, Apr 28, 2006 at 10:35:20PM +0900, Masao M. wrote:

→ rbgobj_closure.c.0.14.1+

  • Try latest CVS Ruby/GLib2.
    Strangely, both fixed the problem for me (with current anon CVS and with
    the
    vanilla 0.14.1 release)… Can you send a backtrace the segv you get ?

Sjoerd

The purpose of Physics 7A is to make the engineers realize that they’re
not perfect, and to make the rest of the people realize that they’re not
engineers.


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

On Thu, May 04, 2006 at 01:22:22PM +0900, Masao M. wrote:

SourceForge.net: Log In to SourceForge.net
Still isn’t fixed unfortunately :frowning:

So, I attached the latest Ruby/GLib2 to this mail which applied your patch.
#rbgobj_closure.c.org is the latest file on CVS.

And the result of backtrace is /gdb_result1.txt.
Unfortunately, gdb result doesn’t have any good informations.

I suspect I did something wrong when I applied your patch by hand.

I’ve looked at it, your patched version wouldn’t work for me:
(ruby: symbol lookup error: /home/sjoerd/build/rbg2/glib2.so:
undefined symbol: g_rclosure_attach)

So i redid the patch based on the rbgobj_closure.c.org file, which works
nicely
again.

In the mean time i’ve updated the patch a little, the callback thread
now
has abort_on_exception set by default and ensures that no callbacks from
other
thread will deadlocked when an exceptions occurs. This is somewhat more
natural as the callback thread is somewhat hidden from the programmer.

Unfortunately it also means that you cannot catch a callback error
outside of
the callback proc object itself (which sucks somewhats…)

I’ve attached both the patch and the complete patched rbgobj_closure.c
file.
Hope this works for you :slight_smile:

Sjoerd

Hi Sjoerd,

Again, it didn’t work … .
I applied your patch to newest Ruby/GLib2 and test it.
It occured segfault.

My gstreamer is 0.8.12.
Should I test it later versions ?

I applied gdb log and your avtest what I used.

On Wed, 10 May 2006 01:03:24 +0200

Hi Sjoerd,

On Sat, 29 Apr 2006 16:05:44 +0200
[email protected] (Sjoerd S.) wrote:

Strangely, both fixed the problem for me (with current anon CVS and with the
vanilla 0.14.1 release)… Can you send a backtrace the segv you get ?

As Joao said, Anon CVS hasn’t been updated for a long time.
I reported it, but it still doesn’t fix.
http://sourceforge.net/tracker/?func=detail&atid=200001&aid=1478973&group_id=1

So, I attached the latest Ruby/GLib2 to this mail which applied your
patch.
#rbgobj_closure.c.org is the latest file on CVS.

And the result of backtrace is /gdb_result1.txt.
Unfortunately, gdb result doesn’t have any good informations.

I suspect I did something wrong when I applied your patch by hand.

Hi Sjoerd,

Unfortunately, it still doesn’t work…

gstreamer 0.8.12.
glib2 2.8.1
ruby 1.8.4 (2005-12-24) [i686-linux]

On Fri, 19 May 2006 12:55:17 +0200

On Sat, May 20, 2006 at 12:55:54PM +0900, Masao M. wrote:

Hi Sjoerd,

Unfortunately, it still doesn’t work…

Then i’m out of ideas. I’ve attached a version with various printf’s for
debugging. If possible could you also provide a valgrind log and a gdb
``thread apply all bt full’’ traceback ?

Sjoerd

Hi,

In [email protected]
“Re: [ruby-gnome2-devel-en] [Patch] handle glib signals coming from
different threads” on Fri, 19 May 2006 12:55:17 +0200,
[email protected] (Sjoerd S.) wrote:

Again, it didn’t work … .
I applied your patch to newest Ruby/GLib2 and test it.
It occured segfault.

Ok, after some valgrinding it seems that the gc was messing with the created
thread for some reason… Fixed in this patch.

In my environment, it seems this patch fixes this problem.

Thanks,

kou


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Hi Sjoerd,

On Sun, 21 May 2006 14:43:12 +0200
[email protected] (Sjoerd S.) wrote:

On Sat, May 20, 2006 at 12:55:54PM +0900, Masao M. wrote:

Hi Sjoerd,

Unfortunately, it still doesn’t work…

Then i’m out of ideas. I’ve attached a version with various printf’s for
debugging. If possible could you also provide a valgrind log and a gdb
``thread apply all bt full’’ traceback ?

OK, here is a gdb log.

Hi,

On Mon, 22 May 2006 23:10:13 +0900 (JST)
Kouhei S. [email protected] wrote:

Ok, after some valgrinding it seems that the gc was messing with the created
thread for some reason… Fixed in this patch.

In my environment, it seems this patch fixes this problem.

Could you tell me more detail about your environment?

I’m afraid my environment something wrong.


.:% Masao M.[email protected]


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

On Sun, May 14, 2006 at 11:12:54PM +0900, Masao M. wrote:

Hi Sjoerd,

Again, it didn’t work … .
I applied your patch to newest Ruby/GLib2 and test it.
It occured segfault.

Ok, after some valgrinding it seems that the gc was messing with the
created
thread for some reason… Fixed in this patch.

The patch is also somewhat simpler then the previous one, because it no
longer
has to handle exceptions.

Hope this one works for you :wink:

Sjoerd

On Tue, May 23, 2006 at 01:59:12AM +0900, Masao M. wrote:

Then i’m out of ideas. I’ve attached a version with various printf’s for
debugging. If possible could you also provide a valgrind log and a gdb
``thread apply all bt full’’ traceback ?

OK, here is a gdb log.

Ah, i think i know what’s going wrong… The output shows you get a
normal
callback, while the traceback indicates that it comes from another
thread…
This probably means that your ruby isn’t configured with
–enable-pthread. Can
you check that?

If --enable-pthread isn’t enabled then is_ruby_native_thread() will
always
return true, causing the normal codepath to be used (which is basically
the
same as what happens to an unpatched version)…

Sjoerd

FORTUNE’S FUN FACTS TO KNOW AND TELL: #44
Zebras are colored with dark stripes on a light background.


Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your job
easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642