Forum: Ruby-Gnome 2 Re: [Patch] handle glib signals coming from different thread

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Masao M. (Guest)
on 2006-04-08 16:30
(Received via mailing list)
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
unknown (Guest)
on 2006-04-11 01:40
(Received via mailing list)
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
Masao M. (Guest)
on 2006-04-11 20:36
(Received via mailing list)
Hi,

On Mon, 10 Apr 2006 23:36:42 +0200
removed_email_address@domain.invalid (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.<removed_email_address@domain.invalid>


-------------------------------------------------------
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...
unknown (Guest)
on 2006-04-11 21:31
(Received via mailing list)
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 :) 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...
Sjoerd S. (Guest)
on 2006-04-20 03:00
(Received via mailing list)
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 :)

  Sjoerd
--
Five is a sufficiently close approximation to infinity.
		-- Robert Firth

"One, two, five."
		-- Monty Python and the Holy Grail
Masao M. (Guest)
on 2006-04-20 03:10
(Received via mailing list)
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. <removed_email_address@domain.invalid> wrote:

> > > > >
> > >
> > Right you need to give it a movie as an argument :) 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.<removed_email_address@domain.invalid>


-------------------------------------------------------
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...
Masao M. (Guest)
on 2006-04-28 17:37
(Received via mailing list)
Hi Sjoerd,

On Thu, 20 Apr 2006 08:08:41 +0900
Masao M. <removed_email_address@domain.invalid> 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.
Joao P. (Guest)
on 2006-04-28 18:23
(Received via mailing list)
Hi Masao,

2. 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.  <removed_email_address@domain.invalid>

For file "ruby-gnome2/gtk/ChangeLog":
2006-03-18  Kouhei S.  <removed_email_address@domain.invalid>


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

*For file ChangeLog in
http://cvs.sourceforge.net/viewcvs.py/ruby-gnome2/...   :

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:
http://img223.imageshack.us/my.php?image=200604231...
That Chess Board uses Ruby-Cairo and Ruby-GNOME2. I still want some
pretty
pieces,
though. :-)

Thanks guys.

Cheers,
Joao

*
*
Masao M. (Guest)
on 2006-04-28 19:28
(Received via mailing list)
Hi,

On Fri, 28 Apr 2006 11:21:44 -0300
"Joao P." <removed_email_address@domain.invalid> wrote:

> Hi Masao,
>
> 2. 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.<removed_email_address@domain.invalid>


-------------------------------------------------------
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...
unknown (Guest)
on 2006-05-03 21:08
(Received via mailing list)
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...
Masao M. (Guest)
on 2006-05-04 08:40
(Received via mailing list)
Hi Sjoerd,

On Sat, 29 Apr 2006 16:05:44 +0200
removed_email_address@domain.invalid (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=2...

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.
unknown (Guest)
on 2006-05-10 03:06
(Received via mailing list)
On Thu, May 04, 2006 at 01:22:22PM +0900, Masao M. wrote:
> http://sourceforge.net/tracker/?func=detail&atid=2...
Still isn't fixed unfortunately :(

> 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 :)

  Sjoerd
Masao M. (Guest)
on 2006-05-14 18:20
(Received via mailing list)
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
unknown (Guest)
on 2006-05-19 14:58
(Received via mailing list)
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 ;)

  Sjoerd
Masao M. (Guest)
on 2006-05-20 07:59
(Received via mailing list)
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
unknown (Guest)
on 2006-05-21 16:46
(Received via mailing list)
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
Kouhei S. (Guest)
on 2006-05-22 18:13
(Received via mailing list)
Hi,

In <removed_email_address@domain.invalid>
  "Re: [ruby-gnome2-devel-en] [Patch] handle glib signals coming from
different threads" on Fri, 19 May 2006 12:55:17 +0200,
  removed_email_address@domain.invalid (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...
Masao M. (Guest)
on 2006-05-22 21:00
(Received via mailing list)
Hi Sjoerd,

On Sun, 21 May 2006 14:43:12 +0200
removed_email_address@domain.invalid (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.
Masao M. (Guest)
on 2006-05-22 21:03
(Received via mailing list)
Hi,

On Mon, 22 May 2006 23:10:13 +0900 (JST)
Kouhei S. <removed_email_address@domain.invalid> 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.<removed_email_address@domain.invalid>


-------------------------------------------------------
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...
unknown (Guest)
on 2006-05-23 02:21
(Received via mailing list)
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...
Kouhei S. (Guest)
on 2006-05-23 03:11
(Received via mailing list)
Hi,

In <removed_email_address@domain.invalid>
  "Re: [ruby-gnome2-devel-en] [Patch] handle glib signals coming from
different threads" on Tue, 23 May 2006 02:00:10 +0900,
  Masao M. <removed_email_address@domain.invalid> 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 sorry, I should show detail about my environment. Here
is my environment:

  % pkg-config --modversion gstreamer-0.8
  0.8.12
  % pkg-config --modversion glib-2.0
  2.10.2
  % ruby -v
  ruby 1.8.4 (2005-12-24) [i486-linux]

I'm using Debian/GNU Linux unstable.


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...
Masao M. (Guest)
on 2006-05-23 19:43
(Received via mailing list)
Hi,

On Tue, 23 May 2006 00:20:31 +0200
removed_email_address@domain.invalid (Sjoerd S.) 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?

Sure. I don't use any options when I configured ruby.
I tried latest ruby in CVS (1.9.0) with --enable-pthread, your patch
works.

> 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)....

AFAIK, --enable-pthread is option(not standard) now, isn't it?

So, if your patch doesn't influence ruby with --disable-pthread option,
I'll apply your patch to CVS.

What do you think?

--
.:% Masao M.<removed_email_address@domain.invalid>


-------------------------------------------------------
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...
unknown (Guest)
on 2006-05-23 21:14
(Received via mailing list)
On Wed, May 24, 2006 at 12:42:09AM +0900, Masao M. wrote:
> I tried latest ruby in CVS (1.9.0) with --enable-pthread, your patch works.
> What do you think?
Sounds great. Very nice to have this mystery solved :) I've attached a
version
of the patch that only enables the code when HAVE_NATIVETHREAD is
defined (thus
when ruby is compiled with --enable-pthread).

I'll add a note to my ruby gst 0.10 bindings that people should really
use a
ruby version compiled with --enable-pthread. You might want to do that
for ruby
gstreamer 0.8 (as that should improve stability a lot).

For the record, Debian's ruby is compiled with --enable-pthread by
default
while Fedora's ruby uses --disable-pthread.

  Sjoerd
Masao M. (Guest)
on 2006-05-26 20:02
(Received via mailing list)
Hi Sjoerd,

OK. Applied it, too.

On Tue, 23 May 2006 19:12:26 +0200
removed_email_address@domain.invalid (Sjoerd S.) wrote:

> > Sure. I don't use any options when I configured ruby.
> >
> For the record, Debian's ruby is compiled with --enable-pthread by default
> while Fedora's ruby uses --disable-pthread.
>
>   Sjoerd
> --
> If they can make penicillin out of moldy bread, they can sure make
> something out of you.
> 		-- Muhammad Ali
>


--
--
.:% Masao M.<removed_email_address@domain.invalid>


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications
in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521...
This topic is locked and can not be replied to.