Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 285749 - [Widgets] SWT crash on Ubuntu -- segfault in pango_layout_new
Summary: [Widgets] SWT crash on Ubuntu -- segfault in pango_layout_new
Status: CLOSED DUPLICATE of bug 322222
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5.1   Edit
Hardware: PC Linux
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Praveen CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 322222
  Show dependency tree
 
Reported: 2009-08-05 14:13 EDT by Roland Gunther CLA Friend
Modified: 2013-11-10 22:32 EST (History)
10 users (show)

See Also:


Attachments
The hs_err file generated when Java segfaults. (43.52 KB, text/x-log)
2009-08-05 14:15 EDT, Roland Gunther CLA Friend
no flags Details
test main illustrating the crash (1.30 KB, text/x-java)
2009-08-05 14:17 EDT, Roland Gunther CLA Friend
no flags Details
Patch v01 (1.71 KB, patch)
2009-10-30 08:16 EDT, Praveen CLA Friend
no flags Details | Diff
The hs_err file generated by jvm (72.47 KB, text/plain)
2010-03-18 02:53 EDT, Meng Xin Zhu CLA Friend
no flags Details
hs_err_pid3720.log (96.47 KB, text/x-log)
2010-07-02 08:04 EDT, Jacek Pospychala CLA Friend
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Gunther CLA Friend 2009-08-05 14:13:08 EDT
Build ID: I20090611-1540

Steps To Reproduce:
1. Run the attached main on Ubuntu.
2. Type a letter in to the text field.
3. The application segfaults in pango_layout_new.


More information:
This bug causes a hard crash on Ubuntu Linux only. The crash happens on Ubuntu 8.04 and 9.04. It does not crash on Centos 5. The correct behavior is for the application to quit on an uncaught exception, not to crash with a segfault.

It seems possible (but not certain) that this bug is related to the much-discussed Ubuntu bug 174759:
https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/174759

The Java VM is 1.6.0_13. The GTK version is 2.16.1.
Comment 1 Roland Gunther CLA Friend 2009-08-05 14:15:30 EDT
Created attachment 143541 [details]
The hs_err file generated when Java segfaults.
Comment 2 Roland Gunther CLA Friend 2009-08-05 14:17:16 EDT
Created attachment 143542 [details]
test main illustrating the crash
Comment 3 Bogdan Gheorghe CLA Friend 2009-08-05 17:03:24 EDT
Praveen, please try this out on your Ubuntu.
Comment 4 Alexis Muller CLA Friend 2009-10-25 03:55:27 EDT
This bug happen very often (making eclipse unusable) with libpango-1.0-0 1.26.0-1 (ubuntu karmic) on amd64 architecture (not try on 32bits).

Happen either with sun-jdk-6 and openjdk-6.

Same eclipse works with previous ubuntu version : libpango1.0-0 (1.24.1-0ubuntu1)
Comment 5 Nathan Summers CLA Friend 2009-10-27 13:43:08 EDT
Also affects Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=522187
Comment 6 Andrew Overholt CLA Friend 2009-10-28 15:38:19 EDT
The test case fails for me with 3.5.1 on Fedora (what will be 12).
Comment 7 Andrew Overholt CLA Friend 2009-10-28 15:38:58 EDT
Updating version to reflect that it's present in 3.5.1.
Comment 8 Praveen CLA Friend 2009-10-30 08:16:13 EDT
Created attachment 150915 [details]
Patch v01

Bogdan, please review the patch and suggest if anything else is required. Thanks.
Comment 9 Silenio Quarti CLA Friend 2009-11-02 12:19:54 EST
Catching application exceptions do not seem like a good idea to me. Why are not those exceptions fixed instead?

The crash log from comment#1 shows Text.gtk_commit() on the stack. The patch has a fix for Text.gtk_text_buffer_insert_text(). It probably fixes the sample app from commnet#2. Does it fixes the original problem?
Comment 10 Praveen CLA Friend 2009-11-06 07:28:18 EST
(In reply to comment #9)
> Catching application exceptions do not seem like a good idea to me. Why are not
> those exceptions fixed instead?
The exception is raised in the user listener handler code. Since that is an uncaught exception, should the exception be handled by JVM to terminate the appl with the exception stack, instead of fixing it ?

> The crash log from comment#1 shows Text.gtk_commit() on the stack. The patch
> has a fix for Text.gtk_text_buffer_insert_text(). It probably fixes the sample
> app from commnet#2. Does it fixes the original problem?

The attached exception log somehow doesn't show the native function stack. While I was recreating the problem, with the exception logs occured on my machine, I realized that the exception was due to the gtk_commit() emitting the commit signal, which is inturn invoking the gtk_text_buffer_insert_text() method. 
The idea of the fix is to block the signal handler only when there is an uncaught exception and before the GTK executes it's default signal handler (with the assumption that SWT finished processing 'commit' signal) leading to crash in native libraries.
Comment 11 Meng Xin Zhu CLA Friend 2010-03-18 02:47:42 EDT
I always met such crash on Helios M6 and Ubuntu 9.10. The same code works fine on 3.5.1. Not sure whether they're same.
Comment 12 Meng Xin Zhu CLA Friend 2010-03-18 02:53:56 EDT
Created attachment 162380 [details]
The hs_err file generated by jvm

The hs_err file generated by jvm
Comment 13 Jacek Pospychala CLA Friend 2010-07-02 08:02:19 EDT
hi this seems to be causing JSDT in Helios to crashing pretty easily. See bug 318697 for details.
Comment 14 Jacek Pospychala CLA Friend 2010-07-02 08:04:16 EDT
Created attachment 173294 [details]
hs_err_pid3720.log

jvm error log generated by JSDT-related crash mentioned in prev. comment.
Comment 15 Jacek Pospychala CLA Friend 2010-07-13 08:05:13 EDT
there's another JSDT issue, probably caused by this:
bug 319609 -  IDE crashes when editing a particular JavaScript source file.
Comment 16 Felipe Heidrich CLA Friend 2010-08-10 09:58:02 EDT

*** This bug has been marked as a duplicate of bug 322222 ***
Comment 17 Felipe Heidrich CLA Friend 2010-08-10 10:06:06 EDT
Roland Gunther, do you know where is the code that is causing the exception in your product ?

If you do, you need to handle the exception before you return from the event handler. That is the real fix for the problem.
Comment 18 Felipe Heidrich CLA Friend 2010-08-10 10:29:55 EDT
(In reply to comment #17)
> Roland Gunther, do you know where is the code that is causing the exception in
> your product ?
> If you do, you need to handle the exception before you return from the event
> handler. That is the real fix for the problem.

Note: At this point I'm not sure we can fix bug 322222, so it is important that you try to handle the exception on your side (it should be easy).
Comment 19 Roland Gunther CLA Friend 2010-08-11 01:32:56 EDT
(In reply to comment #18)
> (In reply to comment #17)
> > Roland Gunther, do you know where is the code that is causing the exception in
> > your product ?
> > If you do, you need to handle the exception before you return from the event
> > handler. That is the real fix for the problem.
> 
> Note: At this point I'm not sure we can fix bug 322222, so it is important that
> you try to handle the exception on your side (it should be easy).

Felipe, thanks for the looking at this.

We did fix the Java exception long ago. However, it does seem that it would be better if SWT did not segfault. I recently reported bug 321929--from your comments, this seems to be the same bug. The Java exception that caused 321929 was easily fixed, but it was a bug that we ran into at a customer's site. Java exceptions happen on occasion, and it would have been nicer if Java had propagated the exception instead of segfaulting.
Comment 20 Felipe Heidrich CLA Friend 2010-08-11 14:06:37 EDT
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=322222#c9

SWT should not crash because of unhandled exception...