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 135489 - gtkhtml2 2.4.0 crashes when using gnochm
gtkhtml2 2.4.0 crashes when using gnochm
Status: RESOLVED FIXED
Product: gtkhtml2
Classification: Deprecated
Component: General
unspecified
Other other
: Normal normal
: ---
Assigned To: padraig.obriain
padraig.obriain
Depends on:
Blocks:
 
 
Reported: 2004-02-26 13:00 UTC by rubensr
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Trace for html_document_finalize (3.38 KB, text/plain)
2004-03-30 09:12 UTC, rubensr
  Details
And another one... (5.70 KB, text/plain)
2004-03-30 09:18 UTC, rubensr
  Details
Proposed patch (1.53 KB, patch)
2004-03-30 11:39 UTC, padraig.obriain
none Details | Review
Crash after patch (8.25 KB, text/plain)
2004-03-30 13:20 UTC, rubensr
  Details
Crash after patch (8.25 KB, text/plain)
2004-03-30 13:21 UTC, rubensr
  Details
Second trace for "crash after patch", using gdb. (3.45 KB, text/plain)
2004-03-30 13:22 UTC, rubensr
  Details
Updated patch (2.39 KB, patch)
2004-03-30 14:09 UTC, padraig.obriain
none Details | Review
Corrected updated patch (2.38 KB, patch)
2004-03-30 14:13 UTC, padraig.obriain
none Details | Review
Crash occurs in a different place now (4.73 KB, text/plain)
2004-03-31 09:12 UTC, rubensr
  Details
Different position, same problem. (4.60 KB, text/plain)
2004-04-01 08:37 UTC, rubensr
  Details
New patch (2.09 KB, patch)
2004-04-14 11:47 UTC, padraig.obriain
none Details | Review

Description rubensr 2004-02-26 13:06:32 UTC
Package: gtkhtml2
Severity: normal
Version: 2.4.0
Synopsis: gtkhtml2 2.4.0 crashes when using gnochm
Bugzilla-Product: gtkhtml2
Bugzilla-Component: General
BugBuddy-GnomeVersion: 2.0 (2.0.3)

Description:
Hi,

 I *think* this problem is not in gnochm (a CHM file viewer using
gnome-python2-gtkhtml2),
because it has been working properly in RedHat8.0 (gtkhtml2 2.0.1).

Steps to reproduce the problem:
1. Open pretty much any file in gnochm
2. follow two or more links
3. crash :) (its pretty consistent)

 I tried to debug libgtkhtml2, and all I could find is that if I remove
"xmlFreeDoc()"
from html_parser_finalize(), the problem goes away.

 Please let me know if you want me to do some more testing - I wasnt
sure what to try.

Thanks!
Rubens




Debugging Information:

Backtrace was generated from 'gnochm'

(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...[New Thread 8192 (LWP 30195)]
(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...0x420ae169 in wait4 () from
/lib/i686/libc.so.6
  • #0 wait4
    from /lib/i686/libc.so.6
  • #1 __DTOR_END__
    from /lib/i686/libc.so.6
  • #2 waitpid
    from /lib/i686/libpthread.so.0
  • #3 libgnomeui_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #4 __pthread_sighandler
    from /lib/i686/libpthread.so.0
  • #5 <signal handler called>
  • #6 g_type_check_instance_cast
    from /usr/lib/libgobject-2.0.so.0
  • #7 dom_Node_mkref
    at dom-node.c line 70
  • #8 dom_Node__get_parentNode
    at dom-node.c line 478
  • #9 html_document_restyle_node
    at htmldocument.c line 85
  • #10 html_document_update_focus_element
    at htmldocument.c line 860
  • #11 html_view_insert_node
    at htmlview.c line 373
  • #12 html_view_build_tree
    at htmlview.c line 395
  • #13 html_view_inserted
    at htmlview.c line 405
  • #14 g_cclosure_marshal_VOID__OBJECT
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #16 signal_emit_unlocked_R
    from /usr/lib/libgobject-2.0.so.0
  • #17 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #18 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #19 html_document_new_node
    at htmldocument.c line 412
  • #20 g_cclosure_marshal_VOID__OBJECT
    from /usr/lib/libgobject-2.0.so.0
  • #21 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #22 signal_emit_unlocked_R
    from /usr/lib/libgobject-2.0.so.0
  • #23 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #24 g_signal_emit
    from /usr/lib/libgobject-2.0.so.0
  • #25 html_parser_emit_new_node
    at htmlparser.c line 42
  • #26 htmlParseStartTag
    from /usr/lib/libxml2.so.2
  • #27 htmlParseTryOrFinish
    from /usr/lib/libxml2.so.2
  • #28 htmlParseChunk
    from /usr/lib/libxml2.so.2
  • #29 html_parser_stream_write

Comment 1 padraig.obriain 2004-03-09 13:12:31 UTC
A similar bug. bug #130789 has been fixed. COuld you try with a later
release. Release 2.5.6 is the latest.
Comment 2 rubensr 2004-03-29 11:32:09 UTC
Same problem happens in 2.5.6 and 2.6.0. Here is the backtrace for 2.6.0:

Backtrace was generated from '/usr/bin/gnochm'

(no debugging symbols found)...Using host libthread_db library
"/lib/tls/libthread_db.so.1".
(no debugging symbols found)...
(no debugging symbols found)...[Thread debugging using libthread_db enabled]
[New Thread -1084422848 (LWP 7118)]
(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...0x0054cc32 in _dl_sysinfo_int80 ()
   from /lib/ld-linux.so.2

Thread 1 (Thread -1084422848 (LWP 7118))

  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2
  • #1 __waitpid_nocancel
    from /lib/tls/libpthread.so.0
  • #2 libgnomeui_module_info_get
    from /usr/lib/libgnomeui-2.so.0
  • #3 <signal handler called>
  • #4 g_type_check_instance_cast
    from /usr/lib/libgobject-2.0.so.0
  • #5 dom_Node_mkref
    at dom-node.c line 69
  • #6 dom_Node__get_parentNode
    at dom-node.c line 477
  • #7 html_document_restyle_node
    at htmldocument.c line 85
  • #8 html_document_update_focus_element
    at htmldocument.c line 860
  • #9 html_view_insert_node
    at htmlview.c line 1908
  • #10 html_view_build_tree
    at htmlview.c line 1940
  • #11 html_view_inserted
    at htmlview.c line 1950
  • #12 g_cclosure_marshal_VOID__OBJECT
    from /usr/lib/libgobject-2.0.so.0
  • #13 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0
  • #14 g_signal_emit_by_name
    from /usr/lib/libgobject-2.0.so.0
  • #15 g_signal_emit_valist
    from /usr/lib/libgobject-2.0.so.0
  • #0 _dl_sysinfo_int80
    from /lib/ld-linux.so.2

Comment 3 padraig.obriain 2004-03-29 14:49:01 UTC
I assume thjat html_document_clear is called before this crash happens. Can you
confirm this and check the value of document->dom_document when
html_document_clear is called.

Comment 4 rubensr 2004-03-30 08:35:32 UTC
No, its not being called at all...
(by the way, not sure if it makes any difference or not, but
cancel_func is not being set at all as well).
Comment 5 padraig.obriain 2004-03-30 08:50:33 UTC
I am not sure either whether not calling cancel_func makes any difference.

Your original comment said that changing html_parser_finalize changed the
behavior. Can you send be a stack trace of when html_parser_finalize is called?
Comment 6 rubensr 2004-03-30 09:05:06 UTC
Sure - from what I can see, it is being called when I am displaying a new page (using html_document_open_stream). If I remove the xmlFreeDoc() line from the code, it doesnt crash anymore (but may be leaking tons of memory :). Here it is:  #0  html_parser_finalize (object=0x8480ef8) at htmlparser.c:187 #1  0x4014c59d in g_object_last_unref () from /usr/lib/libgobject-2.0.so.0 #2  0x4020af0d in html_document_open_stream (document=0x8480ef8,     mime_type=0x831729c "text/html") at htmldocument.c:669 #3  0x400b2f69 in _wrap_html_document_open_stream (self=0x0, args=0x844c9d4,     kwargs=0x0) at gtkhtml2.c:260 #4  0x080cebae in PyCFunction_Call () #5  0x080b1557 in PyObject_Call () #6  0x0807b975 in do_call () #7  0x08079671 in eval_frame () #8  0x0807a10e in PyEval_EvalCodeEx () #9  0x080c21bc in function_call () #10 0x080b1557 in PyObject_Call () #11 0x080b827b in instancemethod_call () #12 0x080b1557 in PyObject_Call () #13 0x0807b339 in PyEval_CallObjectWithKeywords () #14 0x080b150e in PyObject_CallObject () #15 0x400a7989 in pyg_closure_marshal (closure=0x8434378, return_value=0x0,     n_param_values=2, param_values=0xbfffec30, invocation_hint=0xbfffeb38,     marshal_data=0x0) at pygtype.c:669 #16 0x4014a0c0 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #17 0x4015e8b4 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0 #18 0x4015d888 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 ---Type <return> to continue, or q <return> to quit--- #19 0x4015dbd3 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0 #20 0x4022e1ee in html_event_button_release (view=0x8445ce0, event=0x8585168)     at htmlevent.c:242 #21 0x4022faa2 in html_view_button_release (widget=0x8445ce0, event=0x8445ce0)     at htmlview.c:761 #22 0x4032a0e4 in _gtk_marshal_BOOLEAN__BOXED ()    from /usr/lib/libgtk-x11-2.0.so.0 #23 0x4014a467 in g_type_class_meta_marshal ()    from /usr/lib/libgobject-2.0.so.0 #24 0x4014a0c0 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #25 0x4015e369 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0 #26 0x4015d689 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #27 0x4036cfdf in gtk_signal_emit () from /usr/lib/libgtk-x11-2.0.so.0 #28 0x40410413 in gtk_widget_event_internal ()    from /usr/lib/libgtk-x11-2.0.so.0 #29 0x40329e67 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0x40328b45 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #31 0x4058ff21 in gdk_event_dispatch () from /usr/lib/libgdk-x11-2.0.so.0 #32 0x401a1f65 in g_main_dispatch () from /usr/lib/libglib-2.0.so.0 #33 0x401a2f98 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #34 0x401a32ad in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0 #35 0x401a3a1f in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #36 0x4032839f in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 ---Type <return> to continue, or q <return> to quit--- #37 0x40848285 in _wrap_gtk_main (self=0x0) at gtk.override:2928 #38 0x0807b5ae in fast_cfunction () #39 0x08079692 in eval_frame () #40 0x0807a10e in PyEval_EvalCodeEx () #41 0x08077025 in PyEval_EvalCode () #42 0x08096a49 in run_node () #43 0x080959c3 in PyRun_SimpleFileExFlags () #44 0x0809530a in PyRun_AnyFileExFlags () #45 0x0805381c in Py_Main () #46 0x08053269 in main () #47 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6  
Comment 7 rubensr 2004-03-30 09:08:50 UTC
Ugh - try again:  #0  html_parser_finalize (object=0x8480ef8) at htmlparser.c:187 #1  0x4014c59d in g_object_last_unref () from /usr/lib/libgobject-2.0.so.0 #2  0x4020af0d in html_document_open_stream (document=0x8480ef8,     mime_type=0x831729c "text/html") at htmldocument.c:669 #3  0x400b2f69 in _wrap_html_document_open_stream (self=0x0, args=0x844c9d4,     kwargs=0x0) at gtkhtml2.c:260 #4  0x080cebae in PyCFunction_Call () #5  0x080b1557 in PyObject_Call () #6  0x0807b975 in do_call () #7  0x08079671 in eval_frame () #8  0x0807a10e in PyEval_EvalCodeEx () #9  0x080c21bc in function_call () #10 0x080b1557 in PyObject_Call () #11 0x080b827b in instancemethod_call () #12 0x080b1557 in PyObject_Call () #13 0x0807b339 in PyEval_CallObjectWithKeywords () #14 0x080b150e in PyObject_CallObject () #15 0x400a7989 in pyg_closure_marshal (closure=0x8434378, return_value=0x0,     n_param_values=2, param_values=0xbfffec30, invocation_hint=0xbfffeb38,     marshal_data=0x0) at pygtype.c:669 #16 0x4014a0c0 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #17 0x4015e8b4 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0 #18 0x4015d888 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 ---Type <return> to continue, or q <return> to quit--- #19 0x4015dbd3 in g_signal_emit_by_name () from /usr/lib/libgobject-2.0.so.0 #20 0x4022e1ee in html_event_button_release (view=0x8445ce0, event=0x8585168)     at htmlevent.c:242 #21 0x4022faa2 in html_view_button_release (widget=0x8445ce0, event=0x8445ce0)     at htmlview.c:761 #22 0x4032a0e4 in _gtk_marshal_BOOLEAN__BOXED ()    from /usr/lib/libgtk-x11-2.0.so.0 #23 0x4014a467 in g_type_class_meta_marshal ()    from /usr/lib/libgobject-2.0.so.0 #24 0x4014a0c0 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #25 0x4015e369 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0 #26 0x4015d689 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #27 0x4036cfdf in gtk_signal_emit () from /usr/lib/libgtk-x11-2.0.so.0 #28 0x40410413 in gtk_widget_event_internal ()    from /usr/lib/libgtk-x11-2.0.so.0 #29 0x40329e67 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #30 0x40328b45 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 #31 0x4058ff21 in gdk_event_dispatch () from /usr/lib/libgdk-x11-2.0.so.0 #32 0x401a1f65 in g_main_dispatch () from /usr/lib/libglib-2.0.so.0 #33 0x401a2f98 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #34 0x401a32ad in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0 #35 0x401a3a1f in g_main_loop_run () from /usr/lib/libglib-2.0.so.0 #36 0x4032839f in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0 ---Type <return> to continue, or q <return> to quit--- #37 0x40848285 in _wrap_gtk_main (self=0x0) at gtk.override:2928 #38 0x0807b5ae in fast_cfunction () #39 0x08079692 in eval_frame () #40 0x0807a10e in PyEval_EvalCodeEx () #41 0x08077025 in PyEval_EvalCode () #42 0x08096a49 in run_node () #43 0x080959c3 in PyRun_SimpleFileExFlags () #44 0x0809530a in PyRun_AnyFileExFlags () #45 0x0805381c in Py_Main () #46 0x08053269 in main () #47 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6  
Comment 8 rubensr 2004-03-30 09:12:43 UTC
Created attachment 26087 [details]
Trace for html_document_finalize

Trace just requested (my web browser is not happy with cut/paste)
Comment 9 rubensr 2004-03-30 09:18:35 UTC
Created attachment 26088 [details]
And another one...

And now the interesting bit: the previous stack traces were obtained
using bug-buddy. This time, as I am running gdb manually, I got this 
different trace. I also get the following message on stderr:

(gnochm:3190): GLib-GObject-WARNING **: invalid uninstantiatable type `(null)'
in cast to `DomNode'
Comment 10 padraig.obriain 2004-03-30 11:37:49 UTC
The crash is happening because we are leaking some data structures but not all.
Comment 11 padraig.obriain 2004-03-30 11:39:57 UTC
Created attachment 26090 [details] [review]
Proposed patch

Can you check if the attached patch helps?

Where is the file gtkhtml2.c referred to in the stack trace you sent me?
Comment 12 rubensr 2004-03-30 13:15:34 UTC
gtkhtml2.c is part of the gnome-python package - its in the gnome-cvs 
as well. 
 
With your patch, the crash does not occur in the same place anymore  
(things are better), and I get lots of the g_warnings you added: 
 
[rubensr@hal9000 gnochm]$ ./gnochm 
 
(gnochm:9338): HtmlDocument-WARNING **: DomDocument being leaked in 
html_startDocument 
 
(gnochm:9338): HtmlDocument-WARNING **: DomDocument being leaked in 
html_startDocument 
 
(gnochm:9338): HtmlDocument-WARNING **: DomDocument being leaked in 
html_startDocument 
 
(gnochm:9338): HtmlView-WARNING **: Focus element set when inserting toplevel 
node 
 
(gnochm:9338): HtmlDocument-WARNING **: DomDocument being leaked in 
html_startDocument 
 
(gnochm:9338): HtmlView-WARNING **: Focus element set when inserting toplevel 
node 
 
(gnochm:9338): HtmlDocument-WARNING **: DomDocument being leaked in 
html_startDocument 
 
(gnochm:9338): HtmlView-WARNING **: Focus element set when inserting toplevel 
node 
 
Comment 13 rubensr 2004-03-30 13:20:35 UTC
Created attachment 26096 [details]
Crash after patch

After your patch, a strange crash occurs when the cursor leaves/enters
the gtkthml widget (apparently). This trace was obtained using 
bug-buddy. The "old" crash does not seem to happen anymore.
Comment 14 rubensr 2004-03-30 13:21:46 UTC
Created attachment 26097 [details]
Crash after patch

After your patch, a strange crash occurs when the cursor leaves/enters
the gtkthml widget (apparently). This trace was obtained using 
bug-buddy. The "old" crash does not seem to happen anymore.
Comment 15 rubensr 2004-03-30 13:22:57 UTC
Created attachment 26098 [details]
Second trace for "crash after patch", using gdb.

Same crash, now trace generated using gdb.
Comment 16 padraig.obriain 2004-03-30 14:09:03 UTC
Created attachment 26111 [details] [review]
Updated patch

I hope that the updated patch fixes the latest crash and also fixes the
leaking.
Comment 17 padraig.obriain 2004-03-30 14:13:27 UTC
Created attachment 26113 [details] [review]
Corrected updated patch
Comment 18 rubensr 2004-03-31 09:12:16 UTC
Created attachment 26141 [details]
Crash occurs in a different place now

It has moved :)
Now I all I have to do to crash it is open any document...
It will die before anything is displayed.
Comment 19 padraig.obriain 2004-03-31 09:52:18 UTC
Does adding call to "document->dom_document = NULL;" in html_document_init()
help?
Comment 20 rubensr 2004-03-31 10:09:51 UTC
No sorry - same problem. 
Comment 21 padraig.obriain 2004-03-31 10:46:37 UTC
Try changing line 755 or is it line 766 of htmldocument.c from "while (node) {"
to w"hile (DOM_IS_NODE (node)) {"
Comment 22 rubensr 2004-04-01 08:37:58 UTC
Created attachment 26196 [details]
Different position, same problem.

I had also to add a check to prevent xmlFreeNode(top_node) from crashing,
but after that, I think we're back to the original problem, just in a
different place I suspect.
Comment 23 padraig.obriain 2004-04-02 08:02:52 UTC
I think that I am going to have to get to the state that I reproduce this
problem myself. This may take me a few daya as I have some urgent items I need
to work on.
Comment 24 padraig.obriain 2004-04-05 12:39:18 UTC
I have attempted to build gnochm and its dependencies. When I run it I get the
error below. Can you help me resolve this problem.

Traceback (most recent call last):
  • File "/opt/gnome-2.4/bin/gnochm", line 44 in ?
    import gnome.ui
ImportError: No module named ui

Comment 25 rubensr 2004-04-05 23:45:53 UTC
No problem - when you compile gnome-python, you need to make sure that
it is compiling the gnome.ui module. You can check if it is installed
by looking at (usually) /usr/lib/python2.2/site-packages/gnome/ui<something>.so.

If I remember correctly (not using my linux box now) after "configure",
gnome-python prints a summary of the modules it will compile.
Comment 26 padraig.obriain 2004-04-13 08:41:08 UTC
I have got gnochm starting up now.

Can you give me exact instructions on reproducing the problem, i.e. what file do
you open and what links do you follow?
Comment 27 padraig.obriain 2004-04-13 13:35:52 UTC
I am now reproducing a crash with a .chm file supplied by the submitter.
Comment 28 padraig.obriain 2004-04-14 11:47:32 UTC
Created attachment 26646 [details] [review]
New patch

Can you check whether this new patch solves the problem.
Comment 29 rubensr 2004-04-19 12:15:18 UTC
Ok, I tested this in the following environments:

libgtkhtml2 2.4.0, Redhat 8.0    -> Works fine
libgtkhtml2 2.5.6, Fedora Core 1 -> Works fine
libgtkhtml2 2.6.0, Fedora Core 1 -> Works fine

It looks like its fixed! Thanks a lot!
Comment 30 padraig.obriain 2004-04-19 12:50:40 UTC
Patch committed to CVS HEAD.