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

**URL:** <https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749>\
**Category:** Ruby-Gnome 2\
**Created:** [April 8, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749 "2006-04-08T14:30:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 8, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/1 "2006-04-08T14:30:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 10, 2006, 11:40pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/2 "2006-04-10T23:40:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 11, 2006, 6:36pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/3 "2006-04-11T18:36:22Z")

</div>

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](mailto:removed_email_address@domain.invalid)

* * *

This [SF.Net](http://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](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 20, 2006, 1:00am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/4 "2006-04-20T01:00:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 11, 2006, 7:31pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/5 "2006-04-11T19:31:37Z")

</div>

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](http://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](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 20, 2006, 1:10am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/6 "2006-04-20T01:10:13Z")

</div>

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](mailto: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](mailto: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&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 28, 2006, 3:37pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/7 "2006-04-28T15:37:50Z")

</div>

Hi Sjoerd,

On Thu, 20 Apr 2006 08:08:41 +0900  
Masao M. [removed\_email\_address@domain.invalid](mailto: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.

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 28, 2006, 4:23pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/8 "2006-04-28T16:23:48Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

For file “ruby-gnome2/gtk/ChangeLog”:  
2006-03-18 Kouhei S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

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

\*For file ChangeLog in  
[Ruby-GNOME 2 download | SourceForge.net](http://cvs.sourceforge.net/viewcvs.py/ruby-gnome2/ruby-gnome2/gtk/) :

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:

> **[ImageShack - Best place for all of your image hosting and image sharing needs](https://imageshack.com/)**
>
> Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.

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

Thanks guys.

Cheers,  
Joao

- 
-

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [April 28, 2006, 5:28pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/9 "2006-04-28T17:28:35Z")

</div>

Hi,

On Fri, 28 Apr 2006 11:21:44 -0300  
“Joao P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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.[removed\_email\_address@domain.invalid](mailto: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&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 3, 2006, 7:08pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/10 "2006-05-03T19:08:31Z")

</div>

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](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 10, 2006, 1:06am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/11 "2006-05-10T01:06:19Z")

</div>

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

> [SourceForge.net: Log In to SourceForge.net](http://sourceforge.net/tracker/?func=detail&atid=200001&aid=1478973&group_id=1)  
> 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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 14, 2006, 4:20pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/12 "2006-05-14T16:20:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 4, 2006, 6:40am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/13 "2006-05-04T06:40:50Z")

</div>

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=200001&aid=1478973&group\_id=1](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.

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 20, 2006, 5:59am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/14 "2006-05-20T05:59:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 21, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/15 "2006-05-21T14:46:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 22, 2006, 4:13pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/16 "2006-05-22T16:13:23Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto: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&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 22, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/17 "2006-05-22T19:00:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 22, 2006, 7:03pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/18 "2006-05-22T19:03:42Z")

</div>

Hi,

On Mon, 22 May 2006 23:10:13 +0900 (JST)  
Kouhei S. [removed\_email\_address@domain.invalid](mailto: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](mailto: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&bid=263057&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 19, 2006, 12:58pm UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/19 "2006-05-19T12:58:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Masao\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/839c29/32.png) [@Masao\_M](https://www.ruby-forum.com/u/Masao_M)\
**Post date:** [May 23, 2006, 12:21am UTC](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749/20 "2006-05-23T00:21:53Z")

</div>

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](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642)

[Next page](https://www.ruby-forum.com/t/re-patch-handle-glib-signals-coming-from-different-thread/93749.md?page=2)
