GThread system may only be initialized once
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Me TV |
Won't Fix
|
Low
|
Unassigned |
Bug Description
Hi,
I'm failing to launch me-tv (0.5.9) on a Fedora (8) machine. Me-tv will crash everytime due to some threading issue. All this happens on a dual core2 intel machine, with a non-64 bit 2.6.23.14 kernel. Gnome is at 2.20.2, GTK2 at 2.12.5. All dependencies at compile-time were met - or at least autogen / gcc did never complain about anything missing.
Description of problem:
The main window appears, but soon after the application crashes. There is no way to interact with the application before the crash takes place. From what I can tell it has something to do with GThread, but I haven't had the time yet to digg any deeper. Started from the command line, me-tv will last output "GThread-ERROR **: GThread system may only be initialized once. aborting... " before crashing. Detailed Debuginfo file is attached.
How to reproduce:
Launch me-tv (may have to create initial config files)
Wait for Main Window to appear
App will crash
I'll gladly provide any further information needed to resolve this issue.
Cheers,
Matthias
Matthias Adler (matthias-bitshaker) wrote : | #1 |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #2 |
Changed in me-tv: | |
assignee: | nobody → michael-lamothe |
importance: | Undecided → High |
milestone: | none → station-5 |
status: | New → In Progress |
Matthias Adler (matthias-bitshaker) wrote : | #3 |
Hello again,
I have tried 0.5.13, 0.5.14, and the recently released 0.5.15, but unfortunately the above problem persists. I'll keep at it and will try a few things in the coming days. But in the end, it wouldn't come as a total surprise if my particular usb dvb device (cynergy xs hybrid) or pulseaudio is the dealbreaker here. Debugging this issue might take some time.
I'm not packaging for Fedora officially, but could very well imagine to do so. Me-Tv looks very promising to me and appears to be more than just on feature *parity* level compared against Kaffeine when it comes to dvb. Basically, I'd love to see it hit the repositories any time soon.
Matthias Adler (matthias-bitshaker) wrote : | #4 |
Matthias Adler (matthias-bitshaker) wrote : | #5 |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #6 |
Hi Matthias,
The nature of the error message "GThread system may only be initialized once" would suggest that it is an issue with my code. It's a tough one.
If Me TV generates a ~/.me-tv/
There's a preferences window in the application that can drive these settings but obviously you can't get to that.
Thanks,
Michael
Matthias Adler (matthias-bitshaker) wrote : | #7 |
Hi Micheal,
Me Tv generated a config file, so I was able to check out your suggestions. XML editing is OK with me ;)
Altering the audio and video driver options did not yield any positive results. The options I tried for audio: none, auto, alsa, sdl, pulseaudio. Video options checked: auto, xv, opengl, xshm, xxmc, sdl.
I then changed to engine_type value to 'none' ( <add key="engine_type" value="none"/> ) and voila, the app started and worked. Yay ! Preferences can be set from within Me TV, EPG seems to be OK, recording works. Only watching TV won't work this way, of course.
Cheers,
Matthias
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #8 |
- A version of application.cc that checks that the Application class only gets instantiated once. Edit (36.1 KiB, text/x-c++src)
A version of application.cc that checks that the Application class only gets instantiated once.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #9 |
You seem to know what you're doing, so here's another thing to try. Are you able to try this application.cc file for me? Let me know if you need more.
Matthias Adler (matthias-bitshaker) wrote : | #10 |
- me-tv.log after application.cc changes Edit (3.4 KiB, text/plain)
Well, I applied the patch yesterday and the conditional 'if (current_
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #11 |
Matthias Adler (matthias-bitshaker) wrote : | #12 |
Hi, I tried the second application.cc you attached, and this time the exception "Application class can only be instantiated once" is not triggered. The threading issue remains, though. The debug trace looks pretty much the same.
Then, I fired up Anjuta and added debug messages in various parts of the source code. So far, I narrowed the problem down to line 97 in main_window.cc ( engine = new XineEngine();). If I commented the line out, Me TV would start without a problem. So, I altered the code a bit:
if (engine_type == "xine")
{
// catch engine init failure
TRY
engine = new XineEngine();
CATCH
// throw Exception("Could not initialize MainWindow:
engine = NULL;
}
I'll try to take a look at xine_engine.cc, maybe I can find something (but I don't know much about C++ ).
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #13 |
Ok, here's what I've found. It seems to be crashing because one of your xine plugins (input_gnome_vfs) is trying to initialise the GThread system but I've already done that in Me TV. On Debian/Ubuntu the input_gnome_vfs plugin comes from the libxine1-gnome package. If you uninstall libxine1-gnome then I assume input_gnome_vfs won't load which might test my theory.
What version of libxine are you running? Or maybe you're using xine-lib?
Thanks,
Michael
Matthias Adler (matthias-bitshaker) wrote : | #14 |
Your theory is correct, the GTread issue is caused by a xine plugin. On Fedora the problematic plugin is called 'xine-lib-extras' (version 1.1.10.1) and the descriptions says:
This package contains extra plugins for xine-lib:
- EsounD
- JACK
- Pulseaudio
- GDK-Pixbuf
- GNOME VFS
- SMB
- SDL
- AA-lib
- Libcaca
- Image decoding
- DirectFB output
I uninstalled this package and Me TV works without any problem (so far).
Here's a list of all installed xine-lib packages:
xine-lib-
xine-lib-
xine-lib-
xine-lib-
xine-lib-
xine-lib-
Cheers,
Matthias
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #15 |
So that's kind of fixed. But this is not ideal. I wonder how other applications such as gxine and totem get around this issue.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #16 |
It has to be an issue in the plugin. They should be using,
if (!g_thread_
{
g_thread_init (NULL);
}
Me TV does this but it's the first one to call it. Maybe this is a bug in 1.1.10, I'm still on 1.1.8.
Matthias Adler (matthias-bitshaker) wrote : | #17 |
Does this issue not arise on Ubuntu if the 1.1.8 gnome_vfs plugin is installed ? If not, this could indeed be a problem with 1.1.10, or a packaging issue with Fedora (they apply a 67.8 KB patch to the xine-lib source for building the rpm).
I downloaded the source rpm for xine-lib and subpackaged xine-lib-extras into smaller bits. Everything is fine, unless the plugin "xineplug_
if (!g_thread_
g_thread_init (NULL);
only they do not have curly braces around the conditional, and patching the file so there is, does not change anything about the outcome. The comment in the head of the file in line says 'this file is part of totem' (line 5). I tried gxine, but it would not accept my channels.conf for no apparant reason. If the gnome_vfs plugin is installed, gxine launches and plays back videos, though. I haven't yet tried totem-xine.
Matthias Adler (matthias-bitshaker) wrote : | #18 |
Oh, gxine expected the channels.conf file to be in the .xine not in the .gxine directory ... so, watching tv in gxine works with input_gnome_vfs plugin installed.
Matthias Adler (matthias-bitshaker) wrote : | #19 |
Tested Me TV with xine-libs v. 1.1.8 and the GThread issue happens still. Maybe I should file a bug in Fedora bugzillla and see what turns out ...
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #20 |
I have all available xine plugins installed on Ubuntu 7.10 and I don't get the issue.
Maybe gxine doesn't initialise the GThread library, I'll check when I get home.
Here's an idea, can you please comment out the g_thread_init (NULL); line in Me TV and see if it still runs?
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #21 |
And here's another sanity check to try. Put 2 iterations of the GThread initialisation code. i.e.
if (!g_thread_
{
g_thread_init (NULL);
}
if (!g_thread_
{
g_thread_init (NULL);
}
gdk_threads_
This works fine for me. If this fails for you then we know that g_thread_
BTW, removing both of them causes a nice runtime error on my system.
Thanks for all your help. It's nice dealing with people that know their stuff and aren't afraid to get their fingers dirty. I really hope that we can get this working for Fedora.
Matthias Adler (matthias-bitshaker) wrote : | #22 |
You're welcome ;) And I think we are getting close ...
If I put the 2 iterations in, Me TV still crashes with vfs-plugin installed. But then I commented out all function calls to g_thread_init() AND gdk_threads_init() so it looks like this:
if (!g_thread_
{
// g_thread_init (NULL);
}
if (!g_thread_
{
// g_thread_init (NULL);
}
// gdk_threads_init();
after that Me TV starts and works. Yeah!
After that I looked through the GLIB Reference Manual (installed 'DevHelp'). There I stumbled upon this note:
<from manual>
g_thread_init() might only be called once. On the second call it will abort with an error. If you want to make sure that the thread system is initialized, you can do this:
if (!g_thread_
After that line, either the thread system is initialized or, if no thread system is available in GLib (i.e. either G_THREADS_ENABLED is not defined or G_THREADS_IMPL_NONE is defined), the program will abort.
</from manual>
So I wrapped the thread init code in an #ifndef macro (not sure about the G_THREADS_IMPL_NONE part).
#ifndef G_THREADS_ENABLED
// #ifdef G_THREADS_IMPL_NONE
if (!g_thread_
{
g_thread_init (NULL);
}
gdk_
// #endif
#endif
Now Me TV will work with either xine's vfs-plugin installed or not installed. I don't know if this makes any sense ... It appears g_thread_
Cheers,
Matthias
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #23 |
So g_thread_
If you like I can write you a small program to test this.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #24 |
Ok, I've found this bit of text,
"To use g_thread_init() in your program, you have to link with the libraries that the command pkg-config --libs gthread-2.0 outputs"
at http://
This is my bad and will fix it now. Hope that this resolves the issue.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #25 |
Ready for 0.5.19 waiting for test confirmation from Matthias.
Changed in me-tv: | |
status: | In Progress → Fix Committed |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #26 |
Released in 0.5.19.
Changed in me-tv: | |
status: | Fix Committed → Fix Released |
Matthias Adler (matthias-bitshaker) wrote : | #27 |
- Me TV works though 4 things commented out Edit (12.2 MiB, application/ogg)
Hi,
tested release 0.5.20 and unfortuately the threading issue is still there. As noted before, Me TV works for me like a charm even if I alter the application.cc file like this:
if (!g_thread_
{
//g_thread_init (NULL);
}
// gdk_threads_init();
// gnet_init();
// GDK_LOCK;
Really, watching and recording TV, EPG, etc., everything works _with_ threading. At the moment I do not know why. (see attached screencast)
Let's put this issue in the background for a while. I build a rpm which is about to be released into the wild soon. If others confirm that they experience the same threading issues, like those happening on my machine, I could alter the rpm with above changes and see if that is solving the problem for them, too. After all, the xine-vfs plugin triggers some magic in the whole glib/gtk/gnome stack.
For the next few days, I'll just *use* Me TV with these changes to the source code, so I can come up with ideas for blueprints what features would be cool to have in Me TV.
Cheers,
Matthias
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : Re: [Bug 190291] Re: GThread system may only be initialized once | #28 |
Yeah, it might be a good idea to talk to a few guys on your side
(Fedora) to see if anyone has had similar issues.
To summarize, from what I can tell both the VFS input plugin and Me TV
are doing the right thing but g_thread_supported () does not work
properly on your setup. I can confirm that it works here.
Let me know if there's anything I can do to help. Good luck.
Thanks,
Michael
On 24/02/2008, Matthias Adler <email address hidden> wrote:
> Hi,
>
> tested release 0.5.20 and unfortuately the threading issue is still there. As noted before, Me TV works for me like a charm even if I alter the application.cc file like this:
>
> if (!g_thread_
> {
> //g_thread_init (NULL);
> }
>
> // gdk_threads_init();
> // gnet_init();
> // GDK_LOCK;
>
> Really, watching and recording TV, EPG, etc., everything works _with_
> threading. At the moment I do not know why. (see attached screencast)
>
> Let's put this issue in the background for a while. I build a rpm which
> is about to be released into the wild soon. If others confirm that they
> experience the same threading issues, like those happening on my
> machine, I could alter the rpm with above changes and see if that is
> solving the problem for them, too. After all, the xine-vfs plugin
> triggers some magic in the whole glib/gtk/gnome stack.
>
> For the next few days, I'll just *use* Me TV with these changes to the
> source code, so I can come up with ideas for blueprints what features
> would be cool to have in Me TV.
>
> Cheers,
> Matthias
>
> ** Attachment added: "Me TV works though 4 things commented out"
> http://
>
>
> --
> GThread system may only be initialized once
> https:/
>
> You received this bug notification because you are a bug assignee.
>
Changed in me-tv: | |
importance: | High → Low |
status: | Fix Released → In Progress |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #29 |
Over to you.
Changed in me-tv: | |
assignee: | michael-lamothe → matthias-bitshaker |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #30 |
Setting this to incomplete until we get more info.
Changed in me-tv: | |
status: | In Progress → Incomplete |
Matthias Adler (matthias-bitshaker) wrote : | #31 |
Hi,
sorry for the long time no see. The package for Fedora is still in the "review queque" and so far it does not look like anyone has taken a look at it. Anyone interested @see: http://
In the meantime there have been a few kernel and xine-lib updates: Currently kernel 2.6.24.3 (+ patches from 2.6.25) and xine-lib 1.11.1, but the problem still retains (for me).
For everyone bold out there (and having a spare Fedora system available), the rpm is located here: http://
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #32 |
Ha, good luck with that. I'll see if I can find a Fedora 8 disk on the front of a magazine tomorrow.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #33 |
Hi Matthias,
I've installed Fedora 8 but I'm completely lost on how to use the system. i.e. where do I get libxine from. Can you please help? How do I contact you?
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #34 |
Moving this off the radar because we don't know what the issue is and it seems unlikely that it'll be fixed (if Me TV is the source of the issue) for the 0.5 series.
Changed in me-tv: | |
milestone: | station-5 → none |
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #35 |
In 0.6, I'm using GStreamer so this will not be an issue.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #36 |
Well, 0.6 just released and I had to use Xine. GStreamer just doesn't seem to be "up to it". Have you heard anything from your guys?
Matthias Adler (matthias-bitshaker) wrote : | #37 |
Whew, how fast time can pass at times ... and yeah, gstreamer is not there *yet*.
Unfortunately, there has not been shed more light on this issue since when I reported it. The repository maintainers told me that this must be resolved, before they would approve my package. I was checking out 0.6 this afternoon, but there seems to be a runtime problem with glibmm (at least on my main machine). I'll open up another report for this specific issue.
I hope 0.6 will no longer cause any threading problems of this kind. As we found out earlier, input_gnome_vfs is/was the culprit here, and with the introduction of gio the former is obsolete anyways.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #38 |
Wait for 0.6.1.
Michael Lamothe (lamothe-deactivatedaccount-deactivatedaccount) wrote : | #39 |
If you don't mind I might shut this down because you said that the thing that caused it will soon be obsolete. We can just open this back up again if it continues to fail.
Changed in me-tv: | |
assignee: | matthias-bitshaker → lamothe |
milestone: | none → station-6 |
status: | Incomplete → Won't Fix |
Hi Matthias,
I just released 0.5.13 yesterday and would like you to take a look at it, if you've got the time. There were several issues <= 0.5.12. Are you packaging for Fedora?