Re: [gmime-devel] using gmime in a multithreaded application



Thanks Jeff,

That has fixed the segaults but now I've run into another interesting problem. When sending mail through with a bogus from header it seems the library never comes back, for example:

From: =?ISO-8859-1?Q?LibertyMedical=AE?= <redacted redacted com>

Looking with the debugger:

  [1] _private___errno(0xfe350178, 0xfe944212, 0xfe350188, 0xfe350184, 0xfe350180), at 0xfe9352ba
=>[2] charset_convert(cd = 0x80ea210, inbuf = 0xfe3501ee "\xae\xfe\x82\xa1^N^H?", inleft = 1U, outp = 0xfe35023c, outlenp = 0xfe350240, ninval = (nil)), line 1522 in "gmime-utils.c"
  [3] rfc2047_decode_word(in = 0x80ea180 "=?ISO-8859-1?Q?LibertyMedical=AE?=", inlen = 0), line 1824 in "gmime-utils.c"
  [4] g_mime_utils_header_decode_phrase(phrase = 0x80ea180 "=?ISO-8859-1?Q?LibertyMedical=AE?="), line 2011 in "gmime-utils.c"
  [5] _internet_address_set_name(ia = (nil), name = (nil)), line 290 in "internet-address.c"
  [6] decode_mailbox(in = 0xfe350338), line 1517 in "internet-address.c"
  [7] internet_address_list_parse_string(str = 0x80e4810 "=?ISO-8859-1?Q?LibertyMedical=AE?= <redacted redacted com>"), line 1582 in "internet-address.c"
  [8] process_header(object = 0x80e5050, action = "" header = (nil), value = 0x80e4810 "=?ISO-8859-1?Q?LibertyMedical=AE?= <redacted redacted com>"), line 721 in "gmime-message.c"
  [9] message_append_header(object = 0x80e5050, header = 0xfe3503a8 "\xd8^C5\xfe\xf1!\xf6\xfePP^N^H^Xn^N^H^PH^N^H\xf0^M^I^HP", value = (nil)), line 809 in "gmime-message.c"
  [10] g_mime_object_append_header(object = 0xfe3503d8, header = 0x80e6e18 "From", value = (nil)), line 824 in "gmime-object.c"
  [11] parser_construct_leaf_part(parser = 0x80df040, content_type = 0xfe350428, found = 0xfe350458), line 1521 in "gmime-parser.c"
  [12] parser_construct_multipart(parser = 0x80df040, content_type = (nil), found = 0xfe3504a0), line 1695 in "gmime-parser.c"
  [13] g_mime_parser_construct_message(parser = 0x80df040), line 1863 in "gmime-parser.c"

Do I need to do something special to handle cases like this?

Thanks again,
Dan



On Sat, Mar 20, 2010 at 3:06 PM, Jeffrey Stedfast <fejj novell com> wrote:
On 03/19/2010 10:51 PM, Dan Streit wrote:
> Hello,
>
> I'm trying to use gmime in a multi threaded application but I am
> experience some segfaults when starting a lot of worker threads.
>
> [snip]
>
> Am I doing something wrong or is this possibly an environment issue?

You probably need to initialize glib with thread support so that it
knows to lock inside it's memory allocator.

g_thread_init (NULL); ought to do it

http://library.gnome.org/devel/glib/stable/glib-Threads.html#g-thread-init

Jeff




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