After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682398 - GError reuse during IMAP connect routine
GError reuse during IMAP connect routine
Status: RESOLVED FIXED
Product: evolution
Classification: Applications
Component: Mailer
3.4.x (obsolete)
Other Linux
: Normal major
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2012-08-21 21:12 UTC by Paul Menzel
Modified: 2012-09-11 10:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed eds patch (3.99 KB, patch)
2012-08-31 15:36 UTC, Milan Crha
committed Details | Review

Description Paul Menzel 2012-08-21 21:12:58 UTC
Using Debian Sid/unstable and having upgraded from 3.2 to 3.4.3, the first start of Evolution 3.4.3 went fine. After closing it without problem and restarting the whole system, it now started by no messages are displayed and only »Nachrichtenliste wird erzeugt …« (translation: Compiling message list …) is shown. On the terminal I see a lot of errors.

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

(evolution:17710): camel-WARNING **: CamelTcpStreamSSL::read() set its GError but then reported success

(evolution:17710): camel-WARNING **: Error message was: TCP connection reset by peer

(evolution:17710): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Server-Verbindung wurde unerwartet getrennt

It would be nice if these are separate issues if you could split this ticket up accordingly.
Comment 1 Milan Crha 2012-08-27 16:58:43 UTC
Thanks for a bug report. it seems to me that these are caused in a cycle, by reuse of one GError instance. It'll be nice to get backtraces of say two of them, thus it'll be easier to check who reused the GError structure, though the error on CamelTcpStreamSSL::read() suggest pretty well that it did something wrong.
Comment 2 Milan Crha 2012-08-28 12:34:35 UTC
I checked the code and CamelTcpStreamSSL::read() uses CamelTcpStreamRaw::read(), which is setting GError only if the read failed, thus the GError is most likely left from other call. Would it be possible to get a backtrace for the warning, please? You can do that with gdb if you run evolution under it like this:
   $ gdb evolution --ex "b g_logv" --ex r
and when the gdb stops with the GLib-WARNING, then get a bactrace with:
   (gdb) bt
command.
Comment 3 Matthew Barnes 2012-08-28 12:52:50 UTC
I'm guessing Paul is using an IMAPX account.  IMAPX still has a some missing error checking which I didn't get time to fix for 3.6.  It's at the top of my list for 3.7.
Comment 4 Paul Menzel 2012-08-30 09:41:16 UTC
(In reply to comment #0)
> Using Debian Sid/unstable and having upgraded from 3.2 to 3.4.3, the first
> start of Evolution 3.4.3 went fine. After closing it without problem and
> restarting the whole system, it now started by no messages are displayed and
> only »Nachrichtenliste wird erzeugt …« (translation: Compiling message list …)
> is shown. On the terminal I see a lot of errors.

First to clarify the not starting issue, looking through the backtrace I see that a password dialog is opened, but which is not displayed. This seems to be a similar issue to bug 657886 but this has not happened for a long time and just started again after upgrading from 3.2.2 to 3.4.3 and GTK+ was already upgraded *before* so was used by 3.2.2 just fine for some time.

This is related to probably using a Awesome as a window manager and not GNOME with Metacity(?).

[…]
Comment 5 Paul Menzel 2012-08-30 09:47:51 UTC
(In reply to comment #4)
> (In reply to comment #0)
> > Using Debian Sid/unstable and having upgraded from 3.2 to 3.4.3, the first
> > start of Evolution 3.4.3 went fine. After closing it without problem and
> > restarting the whole system, it now started by no messages are displayed and
> > only »Nachrichtenliste wird erzeugt …« (translation: Compiling message list …)
> > is shown. On the terminal I see a lot of errors.
> 
> First to clarify the not starting issue, looking through the backtrace I see
> that a password dialog is opened, but which is not displayed. This seems to be
> a similar issue to bug 657886 but this has not happened for a long time and
> just started again after upgrading from 3.2.2 to 3.4.3 and GTK+ was already
> upgraded *before* so was used by 3.2.2 just fine for some time.
> 
> This is related to probably using a Awesome as a window manager and not GNOME
> with Metacity(?).
> 
> […]

I forgot to add, that in Awesome quite often maximizing and unmaximizing the Evolution seems to get the password dialog to show up.
Comment 6 Paul Menzel 2012-08-30 09:56:19 UTC
(In reply to comment #2)
> I checked the code and CamelTcpStreamSSL::read() uses
> CamelTcpStreamRaw::read(), which is setting GError only if the read failed,
> thus the GError is most likely left from other call. Would it be possible to
> get a backtrace for the warning, please? You can do that with gdb if you run
> evolution under it like this:
>    $ gdb evolution --ex "b g_logv" --ex r
> and when the gdb stops with the GLib-WARNING, then get a bactrace with:
>    (gdb) bt
> command.

Thank you for the instructions. The breakpoint was hit even before a window showed up.

Breakpoint 1, g_logv (log_domain=log_domain@entry=0xb7c894d7 "Gtk", log_level=log_level@entry=G_LOG_LEVEL_DEBUG, 
    format=format@entry=0xb7c92ba4 "Connecting to session manager", args1=args1@entry=0xbffff0ec "\244\274r\267\070F-\200\002")
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c:661
661	/build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c: Datei oder Verzeichnis nicht gefunden.
(gdb) bt
  • #0 g_logv
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c line 661
  • #1 g_log
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c line 792
  • #2 gtk_application_startup_session_dbus
    at /build/buildd-gtk+3.0_3.4.2-3-i386-bj8mVg/gtk+3.0-3.4.2/./gtk/gtkapplication.c line 1249
  • #3 gtk_application_startup_x11
    at /build/buildd-gtk+3.0_3.4.2-3-i386-bj8mVg/gtk+3.0-3.4.2/./gtk/gtkapplication.c line 309
  • #4 gtk_application_startup
    at /build/buildd-gtk+3.0_3.4.2-3-i386-bj8mVg/gtk+3.0-3.4.2/./gtk/gtkapplication.c line 450
  • #5 shell_startup
    at e-shell.c line 791
  • #6 g_cclosure_marshal_VOID__VOIDv
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gobject/gmarshal.c line 115
  • #7 g_type_class_meta_marshalv
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gobject/gclosure.c line 997
  • #8 _g_closure_invoke_va
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gobject/gclosure.c line 840
  • #9 g_signal_emit_valist
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gobject/gsignal.c line 3207
  • #10 g_signal_emit
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gobject/gsignal.c line 3352
  • #11 g_application_register
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/gapplication.c line 1209
  • #12 shell_initable_init
    at e-shell.c line 852
  • #13 g_initable_init
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/ginitable.c line 115
  • #14 g_initable_new_valist
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/ginitable.c line 228
  • #15 g_initable_new
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/ginitable.c line 148
  • #16 create_default_shell
    at main.c line 411
  • #17 main
    at main.c line 647

I hope that is good enough to help you figure out what is going on.

By the way, to surpress the copyright and introductory message you can pass `-q` to `gdb`.
Comment 7 Milan Crha 2012-08-30 11:59:11 UTC
(In reply to comment #6)
> Breakpoint 1, g_logv (log_domain=log_domain@entry=0xb7c894d7 "Gtk",
> log_level=log_level@entry=G_LOG_LEVEL_DEBUG, 

I might also note that g_logv is basically for all logging through glib, thus even for debugging logs. See above "G_LOG_LEVEL_DEBUG" and log_domain being "Gtk". We are looking for log_level GLib and type warning or critical, or the name I forgot they use for these messages - it's just not debug :)

The maximizing - I suppose your window manager hides the password prompt below main Evolution window and even the prompt came (I suppose) after creation of the Evolution's window, then it's just below it, instead of above. In other words, you are right this is caused by the window manager, rather than by a bug in evolution's code. Nonetheless, 3.6.0 will use system dialog, the one provided by Gcr, thus this should be fixed by newer version of evolution.
Comment 8 Paul Menzel 2012-08-30 14:47:01 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Breakpoint 1, g_logv (log_domain=log_domain@entry=0xb7c894d7 "Gtk",
> > log_level=log_level@entry=G_LOG_LEVEL_DEBUG, 
> 
> I might also note that g_logv is basically for all logging through glib, thus
> even for debugging logs. See above "G_LOG_LEVEL_DEBUG" and log_domain being
> "Gtk". We are looking for log_level GLib and type warning or critical, or the
> name I forgot they use for these messages - it's just not debug :)

I am sorry for giving you the wrong trace. It looks like Matthew is right in comment #3. At least IMAP is mentioned in the trace. ;-)

Breakpoint 1, g_logv (log_domain=log_domain@entry=0xb768948e "GLib", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=
    0xb768cf20 "GError set over the top of a previous GError or uninitialized memory.\nThis indicates a bug in someone's code. You must ensure an error is NULL before it's set.\nThe overwriting error message was: %s", 
    args1=args1@entry=0xa2bfea5c "\320\357A\201`\027\374\251`\027\374\251\272<\261\261\203\022\373\251\274\360\277\242\251\017")
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c:661
661	in /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c
  • #0 g_logv
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c line 661
  • #1 g_log
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gmessages.c line 792
  • #2 g_set_error
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gerror.c line 566
  • #3 camel_imap_store_readline
    at camel-imap-store.c line 3323
  • #4 connect_to_server
    at camel-imap-store.c line 327
  • #5 connect_to_server_wrapper
    at camel-imap-store.c line 692
  • #6 imap_store_connect_sync
    at camel-imap-store.c line 841
  • #7 camel_service_connect_sync
    at camel-service.c line 1135
  • #8 camel_offline_store_set_online_sync
    at camel-offline-store.c line 139
  • #9 mail_store_go_online_thread
    at e-mail-store-utils.c line 269
  • #10 run_in_thread
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/gsimpleasyncresult.c line 861
  • #11 io_job_thread
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./gio/gioscheduler.c line 177
  • #12 g_thread_pool_thread_proxy
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gthreadpool.c line 309
  • #13 g_thread_proxy
    at /build/buildd-glib2.0_2.32.3-1-i386-987P8N/glib2.0-2.32.3/./glib/gthread.c line 801
  • #14 start_thread
    at pthread_create.c line 304
  • #15 clone
    at ../sysdeps/unix/sysv/linux/i386/clone.S line 130

Comment 9 Paul Menzel 2012-08-30 14:49:34 UTC
(In reply to comment #7)

[…]

> The maximizing - I suppose your window manager hides the password prompt below
> main Evolution window and even the prompt came (I suppose) after creation of
> the Evolution's window, then it's just below it, instead of above. In other
> words, you are right this is caused by the window manager, rather than by a bug
> in evolution's code.

The strange thing is, that I looked for the password window in the window list and there was none. If it is displayed there is at least an entry in the window list.

Furthermore I stress again, that only Evolution was upgraded. All other (GTK) components had been upgrade some weeks beforehand.

> Nonetheless, 3.6.0 will use system dialog, the one provided by Gcr, thus this should be fixed by
> newer version of evolution.

Let’s hope so. ;-)
Comment 10 Milan Crha 2012-08-31 15:36:26 UTC
Created attachment 223075 [details] [review]
proposed eds patch

for evolution-data-server;

I see in the backtrace that this particular issue is going from imap provider (not imapx), though it can be common for any provider using Camel TCP SSL stream. The chunk in "tcp_stream_ssl_connect" makes sure that if connecting with SSL fails, enabling it on the connection fails, then an error is reported as expected. The advantage (or disadvantage?) of this change is that the connection will be always SSL, if user set it to be SSL, and if SSL enabling fails, then the function reports error state, not success. It is correct to follow user's setup strictly, isn't it? The other chunks try to not propagate error when reports success.

I cannot test this, it works fine for me, thus I would like to ask whether you can compile eds with the patch included and verify the error will be gone. You might see, probably, the "Connection reset by peer" error in UI, if not hidden elsewhere in the code.
Comment 11 Paul Menzel 2012-09-10 16:07:40 UTC
(In reply to comment #10)
> Created an attachment (id=223075) [details] [review]
> proposed eds patch
> 
> for evolution-data-server;
> 
> I see in the backtrace that this particular issue is going from imap provider
> (not imapx), though it can be common for any provider using Camel TCP SSL
> stream. The chunk in "tcp_stream_ssl_connect" makes sure that if connecting
> with SSL fails, enabling it on the connection fails, then an error is reported
> as expected. The advantage (or disadvantage?) of this change is that the
> connection will be always SSL, if user set it to be SSL, and if SSL enabling
> fails, then the function reports error state, not success. It is correct to
> follow user's setup strictly, isn't it? The other chunks try to not propagate
> error when reports success.
> 
> I cannot test this, it works fine for me, thus I would like to ask whether you
> can compile eds with the patch included and verify the error will be gone. You
> might see, probably, the "Connection reset by peer" error in UI, if not hidden
> elsewhere in the code.

I finally was able to build e-d-s [1] to tested your patch. It works great. I do not see these error messages anymore. Is that patch needed for master? If yes, it would be great if you could include your explanation from above to the commit message to make it easier for me to explain to the Debian maintainers why they should included that patch?

Additionally could you please cherry pick that patch to the 3.4 branch?


[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=686941
Comment 12 Paul Menzel 2012-09-10 16:11:02 UTC
By the way, last question. Was that error caused by a specific IMAP account or by all of them?
Comment 13 Milan Crha 2012-09-11 06:43:35 UTC
Yup, patch target is for git master. The gnome-3-4 branch is effectively dead now, there is not planned any update for that version, thus I would rather not commit it there.

Regarding the explanation in the commit, I like the bug numbers being clickable, thus one can see whole story about the change, rather than summarizing it to few sentences. I agree that bug reports can be sometimes long and hard to read, but it's still the place where the change can be discussed.

I believe it was caused by specific account/server. I use IMAP too, but I do not see these warnings with my server. But it's better to understand this the other way, your server uncovered bug in evolution's IMAP code.
Comment 14 Milan Crha 2012-09-11 06:48:57 UTC
Created commit efc20ad in eds master (3.5.92+)
Comment 15 Paul Menzel 2012-09-11 10:43:55 UTC
(In reply to comment #13)

[…]

> Regarding the explanation in the commit, I like the bug numbers being
> clickable, thus one can see whole story about the change, rather than
> summarizing it to few sentences. I agree that bug reports can be sometimes long
> and hard to read, but it's still the place where the change can be discussed.

I moved the discussion to the list. [1]

[…]

Thanks for your fix!


[1] https://mail.gnome.org/archives/evolution-list/2012-September/msg00015.html