console-kit-daemon[9238]: GLib-CRITICAL: Source ID 310 was not found when attempting to remove it

Asked by Wenceslaus Dsilva

Hi Everyone,

I have upgraded my servers from ubuntu 13.10 to 14.04 LTS, and since then my logs are getting filled with
"console-kit-daemon[9238]: GLib-CRITICAL: Source ID 310 was not found when attempting to remove it"

I have an email sent to me for critical issues and I am getting a lot of them with this msg.

I dont know where it is coming for or what is causing the issue, I have 6 servers and all of them are reporting this issue.

Everything else is running fine on the system except for these messages.

These servers are AWS EC2 instances

Revision history for this message
Manfred Hampl (m-hampl) said :
#1

seems to be bug #1264368

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#2

Hi Manfred,

Thank you for pointing out the bug, but how can I get rid of these errors, is there an actual solution for it?

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

I am sorry to say that I do not have any clue what the root cause of that problem is, nor do I know a workaround to make the messages disappear.

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#4

Thank you Manfred, maybe someone else can help me

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#5

Hi Everyone,

I am still getting these errors it would be great if there is any solution for this, I have received 128 email for these errors and I am unable to find the problem

Please help me.

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#6

Found this
https://groups.google.com/forum/#!topic/vim_dev/Pmxb8swH1yE

I will try this and confirm if it solves the problem

Revision history for this message
Manfred Hampl (m-hampl) said :
#7

It seems to me that the cause for the list of error messages and e-mails it twofold:

1. Quote from an upstream (bugzilla.gnome.org) comment:

    https://bugzilla.gnome.org/show_bug.cgi?id=721369

    GLib recently started throwing a warning when g_source_remove()
    is passed garbage (as per warning). Your applications have probably
    been broken for a while, and there's no telling what could actually
    have happened in the past when g_source_remove() would happily close
    any random source because the programmer got the wrong argument to
    g_source_remove().

2. Apparently some programs in consolekit do not care about calling g_source_remove() twice, as this did not have any consequences in the past.

I just searched the source files of consolekit for trusty for g_source_remove() and found it being called in
ck-vt-monitor.c
ck-file-monitor-inotify.c
ck-job.c
ck-run-programs.c
ck-tty-idle-monitor.c

Just taking the first one (ck-vt-monitor.c) I see

...
        if (vt_monitor->priv->process_queue_id > 0) {
                g_source_remove (vt_monitor->priv->process_queue_id);
        }
...

I now assume that to make sure that g_source_remove is not called twice, process_queue_id should be set to zero afterwards.

...
        if (vt_monitor->priv->process_queue_id > 0) {
                g_source_remove (vt_monitor->priv->process_queue_id);
                vt_monitor->priv->process_queue_id = 0;
        }
...

The same __probably__ has to be done also in the other source files,
and __maybe__ also for other function calls like
        if (vt_monitor->priv->event_queue != NULL) {
                g_async_queue_unref (vt_monitor->priv->event_queue);
+ vt_monitor->priv->event_queue = NULL;
        }
        if (vt_monitor->priv->vt_thread_hash != NULL) {
                g_hash_table_destroy (vt_monitor->priv->vt_thread_hash);
+ vt_monitor->priv->vt_thread_hash = NULL;
        }

Please note that this is just a guess.

Anyone volunteering to test this?
Download consolekit source and its build dependencies, add the lines "process_queue_id = 0;" and build and test the new version.

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#8

I would have tried this but I am not very experienced in changing the code and these are our live servers. I would really appriciate if some can help.

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#9

Ok just found something, I only get these errors when I SSH into the servers so is it something to do with SSH

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#10

Hi Guys,

I just read here that console-kit is used for graphical user interface http://askubuntu.com/questions/422265/what-is-console-kit-daemon-for

As I am using a headless ubuntu version, I dont know why it got installed may because I upgraded from 13.10 to 14.04

Also, I have found the following file in /etc/X11/Xsession.d/90consolekit

here are the contents of the file
# -*- sh -*-
# Xsession.d script for ck-launch-session.
#
#
# This file is sourced by Xsession(5), not executed.

CK_LAUNCH_SESSION=/usr/bin/ck-launch-session

is_on_console() {
        session=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
                --type=method_call --print-reply --reply-timeout=2000 \
                /org/freedesktop/ConsoleKit/Manager \
                org.freedesktop.ConsoleKit.Manager.GetCurrentSession \
                | grep path | awk '{print $3}' | sed s/\"//g)
        x11_display=$(dbus-send --system --dest=org.freedesktop.ConsoleKit \
                --type=method_call --print-reply --reply-timeout=2000 \
                $session org.freedesktop.ConsoleKit.Session.GetX11Display \
                | grep string | awk '{print $2}' | sed s/\"//g)

        if [ -z "$x11_display" ] ; then
                return 0
        else
                return 1
        fi
}

# gdm already creates a CK session for us, so do not run the expensive D-Bus
# calls if we have $GDMSESSION
if [ -z "$GDMSESSION" ] && [ -x "$CK_LAUNCH_SESSION" ] && \
 ( [ -z "$XDG_SESSION_COOKIE" ] || is_on_console ) ; then
    STARTUP="$CK_LAUNCH_SESSION $STARTUP"
fi

I would like to know if I disable or uninstall the console-kit program would it harm my server? Like would I still be able to login using ssh and run commands?

Kindly help me please received over 500 email due to this error

Revision history for this message
Arul (aselvan) said :
#11

I have a headless server that started this problem after 14.04 upgrade and I removed the consolekit i.e. "apt-get purge consolekit"

So, if your system is a headless server like mine, the easy solution is to remove the consolekit

Revision history for this message
Wenceslaus Dsilva (wenceslaus-dsilva) said :
#12

Yes I did the same sorry for not updating it here.