Bug 162956 - SWT_AWT crashes virtual machine
Summary: SWT_AWT crashes virtual machine
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-31 12:40 EST by Mario Ortegón CLA
Modified: 2019-09-06 16:06 EDT (History)
3 users (show)

See Also:


Attachments
Log files of the crash (11.58 KB, application/octet-stream)
2006-10-31 12:57 EST, Mario Ortegón CLA
no flags Details
Crash under Java 1.5.0 (12.48 KB, text/plain)
2006-11-02 05:43 EST, Mario Ortegón CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Ortegón CLA 2006-10-31 12:40:38 EST
I have Swing components running inside views using the RCP platform.  Ocasionally, when I have several views with these components on them and the load is high, I will experience random crashes.  All of the crashes say that an EXCEPTION_ACCESS_VIOLATION happened and the current java thread shows at sun.awt.image.BufImgSurfaceData.initRaster(Native Method).

I am attaching three of these bug reports.  It seems that the problem arises sometimes when using gradient painting.  Two crashes are in components I wrote, in one case filling a shape with an alpha color and in the other filling a shape with a gradient pane.  The other crash seems to come from the UI delegate for a button.

Thanks
Comment 1 Mario Ortegón CLA 2006-10-31 12:57:05 EST
Created attachment 53011 [details]
Log files of the crash

This contains several files that document the crash
Comment 2 Steve Northover CLA 2006-10-31 13:13:22 EST
Have you tried using a different JDK?  Perhaps JDK 1.5?
Comment 3 Steve Northover CLA 2006-10-31 13:14:17 EST
Also, can you make the crashes happen when you don't run SWT at all or run AWT/Swing in it's own top level shell?
Comment 4 Steve Northover CLA 2006-10-31 13:19:00 EST
Oleg, got any ideas?

Mario, can you give us any code we can use to recreate the problem?
Comment 5 Oleg Sukhodolsky CLA 2006-11-01 08:02:52 EST
Well, I do not have now, but I'll ask if it is a known issue (test would help though)
Comment 6 Steve Northover CLA 2006-11-01 09:06:31 EST
Yup, need that test case.
Comment 7 Mario Ortegón CLA 2006-11-02 03:15:16 EST
Greetings.  I will write some test case to reproduce the error.  In my program, I have several views with embedded commposites with the SWT_EMBEDDED flag.  I have custom-made swing components.  The error normally happens in the repaint when switching among the different views.  I crashed the application several times to get some more logs, and looking at them I found out that most of the time the crash happens in the fill polygon call

        // Draw the main marker
        g2trans = (Graphics2D)g2.create();
        polygon = createMarker(15, 30);
        g2trans.translate(valueWidth, height / 3);
        g2trans.setColor(BLACK_A50);
        g2trans.fill(polygon);

Create marker just creates a Shape.  Size is fixed

I tried this as a standalone application, and so far I haven't seen any problems with it in several unit test runs.  It happens only when these components are embeddded on SWT, so that leads me to think maybe the Graphic object created has some problems when using alpha on it.  As the problem, unfortunately, happens only sometimes,  I haven't found a way yet to reproduce it in a reliable manner.  I will keep looking and will try to write a test case that always crashes.
Comment 8 Mario Ortegón CLA 2006-11-02 05:43:30 EST
Created attachment 53126 [details]
Crash under Java 1.5.0

I obtained a log file under the latest java version from sun.  I will try to disable all gradient painting and alpha from my classes and see if I can reproduce the error.
Comment 9 Mario Ortegón CLA 2006-11-02 05:45:15 EST
This is the only similar bug I've been able to find in the bug parade from Sun

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4347689
Comment 10 Mario Ortegón CLA 2006-11-06 09:57:08 EST
I am having a lot of problems to write a specific test case that shows this problem.  I have a quick question on something that ocurred to me, maybe that could be the reason.  I always get the error while switching screens (all the screens with swing are tabs in the same folder).  I have a thread (which is not the swing thread) triggering repaints.  I also have the SWT thread forcing repaints, and possibly destroying the graphics context when the window is hidden.  I am thinking that this could be the cause of the bug, does this make any sense?  I will try to go with this line of though and write a test case for it...
Comment 11 Steve Northover CLA 2006-11-06 15:41:47 EST
Try it.
Comment 12 Mario Ortegón CLA 2006-11-08 11:01:37 EST
Hi!

This is basically driving me crazy :D  I haven't been able to reproduce it in a JUnit Test Case, no matter what.  My case launchs the whole application, loads the exact same components and simulates some of the user interaction.  However, tinkering with the code, I realized if I remove all painting using alpha, all gradients using GradientPaint and I use the Metal skin, which uses no gradients (compared to windows xp), the problem doesn't show.  The application won't crash.  The workaround seems to be pretty stable

I was peeking inside the GradientPaint class and I see it uses a Raster.  I guess using gradients and alpha then create Rasters which are the ones being used by the initRaster method.  So avoiding using gradients is a workaround, albeit an ugly one.

I will keep on trying to reproduce the error, but I am running out of ideas... any pointer? :D

And also, it is possible that some other thread destroys the method getCreatedJavaVMs?  In such case I might be looking at the wrong part... I unfortunately have no access to the source code of the problematic class, so I don't know why it is calling this method.

Thanks for your attention

Comment 13 Eclipse Webmaster CLA 2019-09-06 16:06:18 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.