critical warnings when closing a session with HTTPS connections



Hi,

we are seeing critical warnings and sometimes even crashes when calling
soup_session_abort() on a session that has HTTPS connections. The
following warnings can be observed:

 libsoup-WARNING **: Disposing socket 0x8cc6cc8 while still connected

or

 GLib-GIO-CRITICAL **: g_tls_connection_handshake_finish: assertion
`G_IS_TLS_CONNECTION (conn)' failed


This is with libsoup 2.38.0, glib 2.32.0, glib-networking 2.32.0 and
gnutls 2.12.8. Please see attached testcase to easily reproduce the
problem.

Any help in fixing these would be much appreciated.


Regards, Sven


#include <stdlib.h>
#include <glib-object.h>
#include <libsoup/soup.h>


static void quit(int sig);

static GMainLoop *theMainLoop = NULL;
static gboolean s_bQuit = FALSE;

gboolean isQuit()
{
  return s_bQuit;
}

GMainContext *getMainContext()
{
  return g_main_loop_get_context(theMainLoop);
}

static void sigPipe(int sig)
{
}

static void quit(int sig)
{
  if (!s_bQuit)
  {
    s_bQuit = TRUE;

    if (theMainLoop)
    {
      g_main_loop_quit(theMainLoop);
    }
  }
}

gboolean testSoup(int millis);

void soupMessageCB (SoupSession *session, SoupMessage *msg, int millis)
{
  g_printerr("message finished for cancelling after %d millis (msg = %08X)\n", millis, (int)msg);
  g_idle_add((GSourceFunc)&testSoup, (gpointer)(millis + 10));
}

gboolean killSession(SoupSession *s)
{
  g_printerr("cancelling session\n");
  soup_session_abort(s);
  g_object_unref(s);
  return FALSE;
}

gboolean testSoup(int millis)
{
  SoupSession *s = soup_session_async_new();
  SoupMessage *m = soup_message_new("GET", "https://www.google.de";);
  soup_session_queue_message(s, m, (SoupSessionCallback)soupMessageCB, (gpointer)millis);

  g_printerr("\n\ntesting https with cancelling after %d millis (msg = %08X)\n", millis, (int)m);
  g_timeout_add(millis, (GSourceFunc)killSession, s);
  return FALSE;
}


int main(int args, char* argv[])
{
  int fatal_mask;

  signal(SIGINT, quit);
  signal(SIGQUIT, quit);
  signal(SIGTERM, quit);
  signal(SIGPIPE, sigPipe);

  g_type_init();

  fatal_mask = g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK);
  fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;

  g_log_set_always_fatal ((GLogLevelFlags) fatal_mask);

  g_idle_add((GSourceFunc)&testSoup, (gpointer)10);

  theMainLoop = g_main_loop_new(NULL, TRUE);
  g_main_loop_run(theMainLoop);

  return EXIT_SUCCESS;
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]