Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356601

Summary: Empty Shells in Eclipse
Product: [Eclipse Project] Platform Reporter: Johannes Rieken <johannes_rieken>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: adam, eclipse.felipe, lshanmug, patrick, remy.suen, Silenio_Quarti
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
capture 1
none
capture 2
none
patch for problem in comment#5
none
CrashReport from crash after seeing black shells.
none
BadLocationException none

Description Johannes Rieken CLA 2011-09-02 10:25:28 EDT
Build Identifier: 3.7

After some time of working with Eclipse (~ a day or two) I see empty shells. Looks like the no more handles situation on windows computers. I suspect that random crashes of Eclipse are related to this, but I can't confirm, but I have learned to restart Eclipse quickly once I see the empty shell of approaching death.

Reproducible: Sometimes

Steps to Reproduce:
1. Work With Eclipse
2.
3.
Comment 1 Johannes Rieken CLA 2011-09-02 10:25:52 EDT
Created attachment 202677 [details]
capture 1
Comment 2 Johannes Rieken CLA 2011-09-02 10:26:11 EDT
Created attachment 202678 [details]
capture 2
Comment 3 Felipe Heidrich CLA 2011-09-02 10:48:20 EDT
what version of mac os x are you running ?
is that git support that you have installed, anything else ?
Comment 4 Johannes Rieken CLA 2011-09-02 10:56:28 EDT
I see that since I upgraded to Lion (10.7.1). Not git, but Jazz/RTC installed.
Comment 5 Patrick Paulin CLA 2011-09-08 14:59:00 EDT
Just ran into this working with SWT Paperclips - print preview appearing as a blank white rectangle with Lion, worked fine with Snow Leopard. I've been doing some digging and at least in my case it appears the problem is caused by creating a GC with a Printer device. 

The GC doesn't need to be used, just created. Here's a snippet that causes the problem on my OS X Lion install:

public class DialogTest {

	public static void main(String[] args) {
		/* Take this line out and it works */
		new GC(new Printer(Printer.getDefaultPrinterData()));

		Display display = new Display();
		Shell shell = new Shell(display);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 6 Adam CLA 2011-09-30 18:38:00 EDT
*** Bug 359316 has been marked as a duplicate of this bug. ***
Comment 7 Adam CLA 2011-09-30 18:39:36 EDT
bug 359316 has crash logs that happen after seeing this bug.

I've seen it with both 10.6 and 10.7
Comment 8 Felipe Heidrich CLA 2011-10-03 10:24:22 EDT
Silenio, there is a snippet in comment 5, could you please try that on your Lion ? Thanks

Lakshmi, do you have Lion installed already ?
Comment 9 Silenio Quarti CLA 2011-10-03 14:47:08 EDT
The problem from comment#5 happens on Lion and Snow Leopard for me. It happens because the sample code is not calling printer.startDoc()/printer.endDoc(), which could be considered an application error.  I will attach a patch that solves this problem, but the patch will not be released for now. It requires more testing and I believe this problem is not related to original problem or to the problem in comment#6.  

Those are probably memory leaks (shells not being disposed properly?).  It could be a bug in the application code or in SWT.

Johannes, Adam, do you have any other plugins install (which are not in the Eclipse SDK)?
Comment 10 Silenio Quarti CLA 2011-10-03 14:47:55 EDT
Created attachment 204468 [details]
patch for problem in comment#5
Comment 11 Adam CLA 2011-10-03 14:51:14 EDT
I have the following:
Emma
EGit
TeamCity
Google Suite

I also got another crash on saving with a log and exception, I can post that if it would help at all.
Comment 12 Adam CLA 2011-10-03 14:51:47 EDT
Btw, I saw this problem before TC plugin, but I don't remember for the others.
Comment 13 Silenio Quarti CLA 2011-10-03 15:06:51 EDT
I run the following snippet on Snow Leopard (the snippet leaks shells). I am able to create 704 shells before I get a blank shell. If I uncomment the line that disposes shells the snippet finishes properly.

import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


public class Test356601 {
public static void main(String[] args) {
	Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout(1, false));

	for (int i = 0; i < 1000; i++) {
		System.err.println(i);
		Shell s = new Shell();
		s.setVisible(true);
//		s.dispose();
	}

	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 14 Adam CLA 2011-11-23 13:13:09 EST
Created attachment 207439 [details]
CrashReport from crash after seeing black shells.

I saw three blank shells for dialogs and then eclipse crashed.
Comment 15 Hannes Schmidt CLA 2011-12-06 19:01:58 EST
Created attachment 208033 [details]
BadLocationException

I get lots of BadLocationException exceptions in the workspace log before I see the blank dialogs. See attachment.
Comment 16 Silenio Quarti CLA 2012-02-01 12:58:53 EST
I am assuming this is happening because of this shell leak.

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