Update patch for GNOME bug 733081 (IMAPx job stuck with IDLE)

This commit is contained in:
Milan Crha 2014-07-18 12:03:19 +02:00
parent 34c7eecc0e
commit c00eb8fbc8
2 changed files with 93 additions and 23 deletions

View File

@ -1,7 +1,15 @@
diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c.imapx-job-stuck-with-idle evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c.imapx-job-stuck-with-idle evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
--- evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c.imapx-job-stuck-with-idle 2014-07-13 20:22:01.000000000 +0200 --- evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c.imapx-job-stuck-with-idle 2014-07-13 20:22:01.000000000 +0200
+++ evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c 2014-07-16 17:09:07.400131509 +0200 +++ evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c 2014-07-18 11:59:00.797448928 +0200
@@ -390,7 +390,7 @@ struct _CamelIMAPXServerPrivate { @@ -320,6 +320,7 @@ typedef enum {
IMAPX_IDLE_STARTED, /* IDLE continuation received; IDLE active */
IMAPX_IDLE_CANCEL, /* Cancelled from ISSUED state; need to send
DONE as soon as we receive continuation */
+ IMAPX_IDLE_WAIT_DONE /* DONE was issued, waiting for a confirmation response */
} CamelIMAPXIdleState;
#define IMAPX_IDLE_DWELL_TIME 2 /* Number of seconds to remain in PENDING
@@ -390,7 +391,7 @@ struct _CamelIMAPXServerPrivate {
gchar inbox_separator; gchar inbox_separator;
/* IDLE support */ /* IDLE support */
@ -10,16 +18,28 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
GThread *idle_thread; GThread *idle_thread;
GMainLoop *idle_main_loop; GMainLoop *idle_main_loop;
GMainContext *idle_main_context; GMainContext *idle_main_context;
@@ -3054,7 +3054,7 @@ imapx_continuation (CamelIMAPXServer *is @@ -1472,7 +1473,7 @@ imapx_command_start_next (CamelIMAPXServ
"waiting for idle to stop \n");
/* if there are more pending commands,
* then they should be processed too */
- break;
+ return;
case IMAPX_IDLE_STOP_ERROR:
return;
@@ -3054,25 +3055,27 @@ imapx_continuation (CamelIMAPXServer *is
return FALSE; return FALSE;
c (is->tagprefix, "Got continuation response for IDLE \n"); c (is->tagprefix, "Got continuation response for IDLE \n");
- g_mutex_lock (&is->priv->idle_lock); - g_mutex_lock (&is->priv->idle_lock);
+ g_rec_mutex_lock (&is->priv->idle_lock); + g_rec_mutex_lock (&is->priv->idle_lock);
/* We might have actually sent the DONE already! */ /* We might have actually sent the DONE already! */
if (is->priv->idle_state == IMAPX_IDLE_ISSUED) - if (is->priv->idle_state == IMAPX_IDLE_ISSUED)
+ if (is->priv->idle_state == IMAPX_IDLE_ISSUED) {
is->priv->idle_state = IMAPX_IDLE_STARTED; is->priv->idle_state = IMAPX_IDLE_STARTED;
@@ -3063,7 +3063,7 @@ imapx_continuation (CamelIMAPXServer *is - else if (is->priv->idle_state == IMAPX_IDLE_CANCEL) {
+ } else if (is->priv->idle_state == IMAPX_IDLE_CANCEL) {
/* IDLE got cancelled after we sent the command, while
* we were waiting for this continuation. Send DONE * we were waiting for this continuation. Send DONE
* immediately. */ * immediately. */
if (!imapx_command_idle_stop (is, error)) { if (!imapx_command_idle_stop (is, error)) {
@ -27,8 +47,12 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
+ g_rec_mutex_unlock (&is->priv->idle_lock); + g_rec_mutex_unlock (&is->priv->idle_lock);
return FALSE; return FALSE;
} }
is->priv->idle_state = IMAPX_IDLE_OFF; - is->priv->idle_state = IMAPX_IDLE_OFF;
@@ -3072,7 +3072,7 @@ imapx_continuation (CamelIMAPXServer *is + is->priv->idle_state = IMAPX_IDLE_WAIT_DONE;
+ } else if (is->priv->idle_state == IMAPX_IDLE_WAIT_DONE) {
+ /* Do nothing, just wait */
} else {
c (
is->tagprefix, "idle starts in wrong state %d\n", is->tagprefix, "idle starts in wrong state %d\n",
is->priv->idle_state); is->priv->idle_state);
} }
@ -37,7 +61,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
QUEUE_LOCK (is); QUEUE_LOCK (is);
is->literal = NULL; is->literal = NULL;
@@ -3548,9 +3548,9 @@ imapx_command_idle_done (CamelIMAPXServe @@ -3548,9 +3551,9 @@ imapx_command_idle_done (CamelIMAPXServe
camel_imapx_job_take_error (job, local_error); camel_imapx_job_take_error (job, local_error);
} }
@ -49,7 +73,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
imapx_unregister_job (is, job); imapx_unregister_job (is, job);
} }
@@ -3579,29 +3579,23 @@ imapx_job_idle_start (CamelIMAPXJob *job @@ -3579,29 +3582,23 @@ imapx_job_idle_start (CamelIMAPXJob *job
cp = g_queue_peek_head (&ic->parts); cp = g_queue_peek_head (&ic->parts);
cp->type |= CAMEL_IMAPX_COMMAND_CONTINUATION; cp->type |= CAMEL_IMAPX_COMMAND_CONTINUATION;
@ -83,7 +107,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
QUEUE_UNLOCK (is); QUEUE_UNLOCK (is);
camel_imapx_command_unref (ic); camel_imapx_command_unref (ic);
@@ -3690,10 +3684,10 @@ imapx_call_idle (gpointer data) @@ -3690,13 +3687,16 @@ imapx_call_idle (gpointer data)
goto exit; goto exit;
/* XXX Rename to 'pending_lock'? */ /* XXX Rename to 'pending_lock'? */
@ -92,11 +116,18 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
g_source_unref (is->priv->idle_pending); g_source_unref (is->priv->idle_pending);
is->priv->idle_pending = NULL; is->priv->idle_pending = NULL;
- g_mutex_unlock (&is->priv->idle_lock); - g_mutex_unlock (&is->priv->idle_lock);
- if (is->priv->idle_state != IMAPX_IDLE_PENDING)
+ if (is->priv->idle_state != IMAPX_IDLE_PENDING) {
+ g_rec_mutex_unlock (&is->priv->idle_lock);
goto exit;
+ }
+
+ g_rec_mutex_unlock (&is->priv->idle_lock); + g_rec_mutex_unlock (&is->priv->idle_lock);
if (is->priv->idle_state != IMAPX_IDLE_PENDING) g_mutex_lock (&is->priv->select_lock);
goto exit; mailbox = g_weak_ref_get (&is->priv->select_mailbox);
@@ -3765,7 +3759,7 @@ imapx_idle_thread (gpointer data) @@ -3765,7 +3765,7 @@ imapx_idle_thread (gpointer data)
* regressions. * regressions.
*/ */
@ -105,7 +136,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
g_warn_if_fail (is->priv->idle_pending == NULL); g_warn_if_fail (is->priv->idle_pending == NULL);
pending = g_timeout_source_new_seconds (IMAPX_IDLE_DWELL_TIME); pending = g_timeout_source_new_seconds (IMAPX_IDLE_DWELL_TIME);
@@ -3778,7 +3772,7 @@ imapx_idle_thread (gpointer data) @@ -3778,7 +3778,7 @@ imapx_idle_thread (gpointer data)
is->priv->idle_pending = g_source_ref (pending); is->priv->idle_pending = g_source_ref (pending);
g_source_unref (pending); g_source_unref (pending);
@ -114,7 +145,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
g_main_loop_run (is->priv->idle_main_loop); g_main_loop_run (is->priv->idle_main_loop);
@@ -3798,7 +3792,7 @@ imapx_stop_idle (CamelIMAPXServer *is, @@ -3798,36 +3798,40 @@ imapx_stop_idle (CamelIMAPXServer *is,
time (&now); time (&now);
@ -123,7 +154,35 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
switch (is->priv->idle_state) { switch (is->priv->idle_state) {
case IMAPX_IDLE_ISSUED: case IMAPX_IDLE_ISSUED:
@@ -3827,7 +3821,7 @@ imapx_stop_idle (CamelIMAPXServer *is, is->priv->idle_state = IMAPX_IDLE_CANCEL;
- /* fall through */
+ result = IMAPX_IDLE_STOP_SUCCESS;
+ break;
case IMAPX_IDLE_CANCEL:
+ case IMAPX_IDLE_WAIT_DONE:
result = IMAPX_IDLE_STOP_SUCCESS;
break;
case IMAPX_IDLE_STARTED:
if (imapx_command_idle_stop (is, error)) {
result = IMAPX_IDLE_STOP_SUCCESS;
+ is->priv->idle_state = IMAPX_IDLE_WAIT_DONE;
} else {
result = IMAPX_IDLE_STOP_ERROR;
+ is->priv->idle_state = IMAPX_IDLE_OFF;
goto exit;
}
- /* fall through */
+ break;
case IMAPX_IDLE_PENDING:
is->priv->idle_state = IMAPX_IDLE_OFF;
- /* fall through */
+ break;
case IMAPX_IDLE_OFF:
break;
} }
exit: exit:
@ -132,16 +191,24 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
return result; return result;
} }
@@ -3838,7 +3832,7 @@ imapx_start_idle (CamelIMAPXServer *is) @@ -3838,9 +3842,14 @@ imapx_start_idle (CamelIMAPXServer *is)
if (camel_application_is_exiting) if (camel_application_is_exiting)
return; return;
- g_mutex_lock (&is->priv->idle_lock); - g_mutex_lock (&is->priv->idle_lock);
+ g_rec_mutex_lock (&is->priv->idle_lock); + g_rec_mutex_lock (&is->priv->idle_lock);
+
+ if (is->priv->idle_state != IMAPX_IDLE_OFF) {
+ g_warn_if_fail (is->priv->idle_state == IMAPX_IDLE_OFF);
+ g_rec_mutex_unlock (&is->priv->idle_lock);
+ return;
+ }
g_return_if_fail (is->priv->idle_state == IMAPX_IDLE_OFF); - g_return_if_fail (is->priv->idle_state == IMAPX_IDLE_OFF);
is->priv->idle_state = IMAPX_IDLE_PENDING; is->priv->idle_state = IMAPX_IDLE_PENDING;
@@ -3861,7 +3855,7 @@ imapx_start_idle (CamelIMAPXServer *is)
if (is->priv->idle_thread == NULL) {
@@ -3861,7 +3870,7 @@ imapx_start_idle (CamelIMAPXServer *is)
g_source_unref (pending); g_source_unref (pending);
} }
@ -150,7 +217,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
} }
static gboolean static gboolean
@@ -3869,12 +3863,12 @@ imapx_in_idle (CamelIMAPXServer *is) @@ -3869,12 +3878,12 @@ imapx_in_idle (CamelIMAPXServer *is)
{ {
gboolean in_idle = FALSE; gboolean in_idle = FALSE;
@ -165,7 +232,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
return in_idle; return in_idle;
} }
@@ -7809,7 +7803,7 @@ imapx_server_finalize (GObject *object) @@ -7809,7 +7818,7 @@ imapx_server_finalize (GObject *object)
g_hash_table_destroy (is->priv->known_alerts); g_hash_table_destroy (is->priv->known_alerts);
g_mutex_clear (&is->priv->known_alerts_lock); g_mutex_clear (&is->priv->known_alerts_lock);
@ -174,7 +241,7 @@ diff -up evolution-data-server-3.12.4/camel/providers/imapx/camel-imapx-server.c
g_main_loop_unref (is->priv->idle_main_loop); g_main_loop_unref (is->priv->idle_main_loop);
g_main_context_unref (is->priv->idle_main_context); g_main_context_unref (is->priv->idle_main_context);
@@ -7993,7 +7987,7 @@ camel_imapx_server_init (CamelIMAPXServe @@ -7993,7 +8002,7 @@ camel_imapx_server_init (CamelIMAPXServe
main_context = g_main_context_new (); main_context = g_main_context_new ();

View File

@ -32,7 +32,7 @@
Name: evolution-data-server Name: evolution-data-server
Version: 3.12.4 Version: 3.12.4
Release: 2%{?dist} Release: 3%{?dist}
Group: System Environment/Libraries Group: System Environment/Libraries
Summary: Backend data server for Evolution Summary: Backend data server for Evolution
License: LGPLv2+ License: LGPLv2+
@ -386,6 +386,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%endif %endif
%changelog %changelog
* Fri Jul 18 2014 Milan Crha <mcrha@redhat.com> - 3.12.4-3
- Update patch for GNOME bug 733081 (IMAPx job stuck with IDLE)
* Wed Jul 16 2014 Milan Crha <mcrha@redhat.com> - 3.12.4-2 * Wed Jul 16 2014 Milan Crha <mcrha@redhat.com> - 3.12.4-2
- Add patch for GNOME bug 733081 (IMAPx job stuck with IDLE) - Add patch for GNOME bug 733081 (IMAPx job stuck with IDLE)