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 273430 - 100% of CPU parsing 1.5MB G/W XML blob ...
100% of CPU parsing 1.5MB G/W XML blob ...
Status: RESOLVED DUPLICATE of bug 273286
Product: evolution-data-server
Classification: Platform
Component: Contacts
1.2.x (obsolete)
Other All
: Normal critical
: ---
Assigned To: Sivaiah
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2005-03-07 11:53 UTC by Michael Meeks
Modified: 2013-09-14 16:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Meeks 2005-03-07 11:53:58 UTC
So - running evo. I end up with a growing number of e-d-s threads fighting
for 100% of my CPU - this is not good.

The stacktrace of one looks like this:

(gdb) bt
  • #0 xmlStrlen
    at xmlstring.c line 426
  • #1 xmlStrncat
    at xmlstring.c line 454
  • #2 xmlNodeAddContentLen
    at tree.c line 5201
  • #3 xmlNodeAddContent
    at tree.c line 5241
  • #4 xmlAddNextSibling
    at tree.c line 2836
  • #5 xmlStringGetNodeList
    at tree.c line 1482
  • #6 xmlNodeSetContent
  • #7 foreach_save_func
    at e-xml-hash-utils.c line 95
  • #8 g_hash_table_foreach
    from /opt/gnome/lib/libglib-2.0.so.0
  • #9 e_xml_from_hash
    at e-xml-hash-utils.c line 114
  • #10 e_xmlhash_write
    at e-xml-hash-utils.c line 249
  • #11 e_file_cache_add_object
    at e-file-cache.c line 410
  • #12 e_file_cache_replace_object
  • #13 e_book_backend_cache_add_contact
    at e-book-backend-cache.c line 275
  • #14 build_cache
    at e-book-backend-groupwise.c line 2196
  • #15 g_thread_create_proxy
    from /opt/gnome/lib/libglib-2.0.so.0
  • #16 pthread_start_thread
    from /lib/libpthread.so.0
  • #17 clone
    from /lib/libc.so.6
  • #9 e_xml_from_hash
    at e-xml-hash-utils.c line 114
  • #8 g_hash_table_foreach
    from /opt/gnome/lib/libglib-2.0.so.0
  • #7 foreach_save_func
    at e-xml-hash-utils.c line 95
  • #6 xmlNodeSetContent
    at tree.c line 5035
$4 = (
    const xmlChar *) 0x415c6008
"BEGIN:VCARD
\nVERSION:3.0
\nX-EVOLUTION
-LIST:TRUE
\nX-EVOLUTION-LIST-SHOW_ADDRESSES:TRUE
\nUID:206AEC01-231A-00
00-99FF-0050DA7950E0@58:GroupWiseSystemAddressBook@52
\nX-EVOLUTION-FILE-A".
..
(gdb) p strlen(content)
$5 = 1428469

ie. we are calling xmlNodeSetContent with a 1.5Mb string.

_Clearly_ this method is not designed [ at all ] to parse a huge blob of
XML; and it's doing so in a horrifically inefficient way.

Quite apart from that, it seems pretty shocking to have this huge blob of
XML in a single, contiguous chunk of memory, the design is prolly broken
somewhere here.

If you want to parse a large static XML string, the best way to do it is
with the libxml parser API. Of course - why you want to turn 1.5 MB of
string into another set of hundreds of _Extremely heavyweight_ xml node
items I have no idea [ that will prolly double the size of the data ].

Are you certain you don't want to be using a light-weight SAX parser here;
eg. libbonoboui/bonobo/bonobo-ui-node (bonobo_ui_node_from_string) coupled
with your own more efficient representation ?
Comment 1 Michael Meeks 2005-03-07 14:14:24 UTC
JP - interesting ?
Comment 2 Elijah Newren 2005-04-09 23:10:33 UTC
Same stack trace as 273286.

*** This bug has been marked as a duplicate of 273286 ***