×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    23

    S60 3rd FP2: race condition in layout manager?

    Hi,

    while trying to fix the problem with my hanging midlet (see http://discussion.forum.nokia.com/fo...d.php?t=135377), I identified some strange but reproducable phenomena:

    1) If I put a breakpoint somewhere within the form layout / item size calculation mechanism (e.g. in callback getMinContentHeight() of a class derived from CustomItem), the midlet somewhat later runs into an infinite loop or deadlock when calling setCurrent(). If I disable the breakpoint, the midlet works normal.

    2) My midlet works fine as long as there are not more than 24 CustomItems on a Form. If I add one more CustomItem, the midlet runs into the same infinite loop or deadlock. To make it even more bizarre: If I use SetCurrentItem() to display the form instead of setCurrent(), the same happens already if I have more than 22 CustomItems. I tried this with different forms and different CustomItems but the "limits" are always the same.

    Can anyone - probably some from NOKIA - help me with some questions:
    1) Can you give me a more detailed description of the layout management and the call sequences and dependencies in there? Is there a more detailed documentation available than the device independent stuff in the JSR-118 javadoc?
    2) Do I have to consider thread issues (the debugger shows 5 threads + main + deamon; my code runs in thread 0)?

    Here's some more information about my environment
    - S60_3rd_Edition_FP2_SDK
    - MIDP 2.0
    - CLDC 1.1
    - EclipseME 1.7.9
    - Eclipe 3.3.2
    All tests where done in the emulator, not on a 'real' device.

    Thanks in advance

    JS

  2. #2
    Registered User
    Join Date
    May 2008
    Posts
    23

    Exclamation Re: S60 3rd FP2: race condition in layout manager?

    Having spent some hours of testing and debugging, I consider the problem described here as a BUG.

    I condensed the code into a small demo; could anyone please try to verify/confirm?

    Technology: MIDP 2.0 lcdui
    Reported against: Nokia S60 3rd Edition FP2 (Emulator)
    Subject: Midlet gets deadlocked during screen layout
    Detailed description: If you put more that (about) 22-24 CustomItems on a form, the midlet will hang up in the call of Display.setCurrent() or Display.setCurrentItem(), i.e. the form will not be displayed. In the debugger, you can see that one thread hangs in Form._setCurrentItem(), another one in CustomItemTest.handleSizeChanged(). For a crosscheck, just comment out about 10 of the append() statements and run the midlet again. Then it'll work.

    How to reproduce:
    the MIDlet:
    Code:
    package main;
    
    import javax.microedition.lcdui.Display;
    import javax.microedition.midlet.MIDlet;
    
    public class MidletTest extends MIDlet
    {
    
        public void startApp()
        {
    		FormTest frmTest = new FormTest(Display.getDisplay(this));
    		frmTest.open(1);
        }
        
        public void destroyApp(boolean b)
        {
        }
        
        /**
         * Pausing is not supported in NOKIA's Series 40 and 60 MIDP implementations.
         */
        public void pauseApp()
        {
        }
        	
    	public void quit() {
    		notifyDestroyed();
        }
    }
    the Form:
    Code:
    package main;
    
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    
    import main.CustomItemTest;
    
    public class FormTest extends Form
    {
    	private final Display display;
    	
    	private final CustomItemTest item00;
    	private final CustomItemTest item01;
    	private final CustomItemTest item02;
    	private final CustomItemTest item03;
    	private final CustomItemTest item04;
    	private final CustomItemTest item05;
    	private final CustomItemTest item06;
    	private final CustomItemTest item07;
    	private final CustomItemTest item08;
    	private final CustomItemTest item09;
    	private final CustomItemTest item10;
    	private final CustomItemTest item11;
    	private final CustomItemTest item12;
    	private final CustomItemTest item13;
    	private final CustomItemTest item14;
    	private final CustomItemTest item15;
    	private final CustomItemTest item16;
    	private final CustomItemTest item17;
    	private final CustomItemTest item18;
    	private final CustomItemTest item19;
    	private final CustomItemTest item20;
    	private final CustomItemTest item21;
    	private final CustomItemTest item22;
    	private final CustomItemTest item23;
    	private final CustomItemTest item24;
    	private final CustomItemTest item25;
    	private final CustomItemTest item26;
    	private final CustomItemTest item27;
    	private final CustomItemTest item28;
    	private final CustomItemTest item29;
    	
    	public FormTest(Display pDisplay)
    	{
    		super("test screen");
    		
    		this.display = pDisplay;
    		
        	this.item00 = new CustomItemTest();
        	this.item01 = new CustomItemTest();
        	this.item02 = new CustomItemTest();
        	this.item03 = new CustomItemTest();
        	this.item04 = new CustomItemTest();
        	this.item05 = new CustomItemTest();
        	this.item06 = new CustomItemTest();
        	this.item07 = new CustomItemTest();
        	this.item08 = new CustomItemTest();
        	this.item09 = new CustomItemTest();
        	this.item10 = new CustomItemTest();
        	this.item11 = new CustomItemTest();
        	this.item12 = new CustomItemTest();
        	this.item13 = new CustomItemTest();
        	this.item14 = new CustomItemTest();
        	this.item15 = new CustomItemTest();
        	this.item16 = new CustomItemTest();
        	this.item17 = new CustomItemTest();
        	this.item18 = new CustomItemTest();
        	this.item19 = new CustomItemTest();
        	this.item20 = new CustomItemTest();
        	this.item21 = new CustomItemTest();
        	this.item22 = new CustomItemTest();
        	this.item23 = new CustomItemTest();
        	this.item24 = new CustomItemTest();
        	this.item25 = new CustomItemTest();
        	this.item26 = new CustomItemTest();
        	this.item27 = new CustomItemTest();
        	this.item28 = new CustomItemTest();
        	this.item29 = new CustomItemTest();
        	
    		append(this.item00);
    		append(this.item01);
    		append(this.item02);
    		append(this.item03);
    		append(this.item04);
    		append(this.item05);
    		append(this.item06);
    		append(this.item07);
    		append(this.item08);
    		append(this.item09);
    		append(this.item10);
    		append(this.item11);
    		append(this.item12);
    		append(this.item13);
    		append(this.item14);
    		append(this.item15);
    		append(this.item16);
    		append(this.item17);
    		append(this.item18);
    		append(this.item19);
    		
    		append(this.item20);
    		append(this.item21);
    		append(this.item22);
    		append(this.item23);
    		append(this.item24);		
    		append(this.item25);				
    		append(this.item26);
    		append(this.item27);
    		append(this.item28);		
    		append(this.item29);				
    
    	}
    
    	public void open(int pFocus) {
    		
    		display.setCurrentItem(get(pFocus));
    	}
    }
    the CustomItem:
    Code:
    package main;
    
    import javax.microedition.lcdui.CustomItem;
    import javax.microedition.lcdui.Graphics;
    
    public class CustomItemTest extends CustomItem {
    	
    	public CustomItemTest() {
    		super("");
    	}
    	
    	protected void paint(Graphics pGraphics, int pWidth, int pHeight) {
    		
    		pGraphics.setColor(0x00ffffaa);
    
    		pGraphics.fillRect(1, 1, pWidth - 2, pHeight - 2);
    
    		pGraphics.setColor(0x00000000);
    		
    		pGraphics.drawString("TEST", 0, 0, Graphics.TOP | Graphics.LEFT);
    
    	}
    
    	protected int getMinContentHeight() {
    		return 20;
    	}
    
    	protected int getMinContentWidth() {
    		return 40;
    	}
    
    	protected int getPrefContentHeight(int arg0) {
    		return 20;
    	}
    
    	protected int getPrefContentWidth(int arg0) {
    		return 40;
    	}
    }

    Regards

    JS

  3. #3
    Registered User
    Join Date
    Aug 2009
    Posts
    1

    Re: S60 3rd FP2: race condition in layout manager?

    Quote Originally Posted by schoenke View Post
    Having spent some hours of testing and debugging, I consider the problem described here as a BUG.

    I condensed the code into a small demo; could anyone please try to verify/confirm?

    Technology: MIDP 2.0 lcdui
    Reported against: Nokia S60 3rd Edition FP2 (Emulator)
    Subject: Midlet gets deadlocked during screen layout
    Detailed description: If you put more that (about) 22-24 CustomItems on a form, the midlet will hang up in the call of Display.setCurrent() or Display.setCurrentItem(), i.e. the form will not be displayed. In the debugger, you can see that one thread hangs in Form._setCurrentItem(), another one in CustomItemTest.handleSizeChanged(). For a crosscheck, just comment out about 10 of the append() statements and run the midlet again. Then it'll work.

    How to reproduce:
    the MIDlet:
    Code:
    package main;
    
    import javax.microedition.lcdui.Display;
    import javax.microedition.midlet.MIDlet;
    
    public class MidletTest extends MIDlet
    {
    
        public void startApp()
        {
    		FormTest frmTest = new FormTest(Display.getDisplay(this));
    		frmTest.open(1);
        }
        
        public void destroyApp(boolean b)
        {
        }
        
        /**
         * Pausing is not supported in NOKIA's Series 40 and 60 MIDP implementations.
         */
        public void pauseApp()
        {
        }
        	
    	public void quit() {
    		notifyDestroyed();
        }
    }
    the Form:
    Code:
    package main;
    
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Form;
    
    import main.CustomItemTest;
    
    public class FormTest extends Form
    {
    	private final Display display;
    	
    	private final CustomItemTest item00;
    	private final CustomItemTest item01;
    	private final CustomItemTest item02;
    	private final CustomItemTest item03;
    	private final CustomItemTest item04;
    	private final CustomItemTest item05;
    	private final CustomItemTest item06;
    	private final CustomItemTest item07;
    	private final CustomItemTest item08;
    	private final CustomItemTest item09;
    	private final CustomItemTest item10;
    	private final CustomItemTest item11;
    	private final CustomItemTest item12;
    	private final CustomItemTest item13;
    	private final CustomItemTest item14;
    	private final CustomItemTest item15;
    	private final CustomItemTest item16;
    	private final CustomItemTest item17;
    	private final CustomItemTest item18;
    	private final CustomItemTest item19;
    	private final CustomItemTest item20;
    	private final CustomItemTest item21;
    	private final CustomItemTest item22;
    	private final CustomItemTest item23;
    	private final CustomItemTest item24;
    	private final CustomItemTest item25;
    	private final CustomItemTest item26;
    	private final CustomItemTest item27;
    	private final CustomItemTest item28;
    	private final CustomItemTest item29;
    	
    	public FormTest(Display pDisplay)
    	{
    		super("test screen");
    		
    		this.display = pDisplay;
    		
        	this.item00 = new CustomItemTest();
        	this.item01 = new CustomItemTest();
        	this.item02 = new CustomItemTest();
        	this.item03 = new CustomItemTest();
        	this.item04 = new CustomItemTest();
        	this.item05 = new CustomItemTest();
        	this.item06 = new CustomItemTest();
        	this.item07 = new CustomItemTest();
        	this.item08 = new CustomItemTest();
        	this.item09 = new CustomItemTest();
        	this.item10 = new CustomItemTest();
        	this.item11 = new CustomItemTest();
        	this.item12 = new CustomItemTest();
        	this.item13 = new CustomItemTest();
        	this.item14 = new CustomItemTest();
        	this.item15 = new CustomItemTest();
        	this.item16 = new CustomItemTest();
        	this.item17 = new CustomItemTest();
        	this.item18 = new CustomItemTest();
        	this.item19 = new CustomItemTest();
        	this.item20 = new CustomItemTest();
        	this.item21 = new CustomItemTest();
        	this.item22 = new CustomItemTest();
        	this.item23 = new CustomItemTest();
        	this.item24 = new CustomItemTest();
        	this.item25 = new CustomItemTest();
        	this.item26 = new CustomItemTest();
        	this.item27 = new CustomItemTest();
        	this.item28 = new CustomItemTest();
        	this.item29 = new CustomItemTest();
        	
    		append(this.item00);
    		append(this.item01);
    		append(this.item02);
    		append(this.item03);
    		append(this.item04);
    		append(this.item05);
    		append(this.item06);
    		append(this.item07);
    		append(this.item08);
    		append(this.item09);
    		append(this.item10);
    		append(this.item11);
    		append(this.item12);
    		append(this.item13);
    		append(this.item14);
    		append(this.item15);
    		append(this.item16);
    		append(this.item17);
    		append(this.item18);
    		append(this.item19);
    		
    		append(this.item20);
    		append(this.item21);
    		append(this.item22);
    		append(this.item23);
    		append(this.item24);		
    		append(this.item25);				
    		append(this.item26);
    		append(this.item27);
    		append(this.item28);		
    		append(this.item29);				
    
    	}
    
    	public void open(int pFocus) {
    		
    		display.setCurrentItem(get(pFocus));
    	}
    }
    the CustomItem:
    Code:
    package main;
    
    import javax.microedition.lcdui.CustomItem;
    import javax.microedition.lcdui.Graphics;
    
    public class CustomItemTest extends CustomItem {
    	
    	public CustomItemTest() {
    		super("");
    	}
    	
    	protected void paint(Graphics pGraphics, int pWidth, int pHeight) {
    		
    		pGraphics.setColor(0x00ffffaa);
    
    		pGraphics.fillRect(1, 1, pWidth - 2, pHeight - 2);
    
    		pGraphics.setColor(0x00000000);
    		
    		pGraphics.drawString("TEST", 0, 0, Graphics.TOP | Graphics.LEFT);
    
    	}
    
    	protected int getMinContentHeight() {
    		return 20;
    	}
    
    	protected int getMinContentWidth() {
    		return 40;
    	}
    
    	protected int getPrefContentHeight(int arg0) {
    		return 20;
    	}
    
    	protected int getPrefContentWidth(int arg0) {
    		return 40;
    	}
    }

    Regards

    JS
    Dear All .
    i found the solution but it's not normal because it use Thread
    and we cant decide the behavior of thread
    the solution is to append items inside Thread Like .
    Thread th=new Thread()
    {
    public void run()
    {
    for(int i=0;i<100;i++)
    {
    form.append(item); /// item that you create
    }
    }

    };
    th.setPeriorty(Thread.MaxPeriorty);
    th.start();


    Youssef

Similar Threads

  1. MobInfo API on S60 3rd Ed FP2
    By gerdavax in forum Mobile Java General
    Replies: 2
    Last Post: 2008-07-15, 15:51
  2. Authorization Failed, lapi.jar, S60 3rd FP2
    By sandymc in forum Mobile Java General
    Replies: 5
    Last Post: 2008-05-23, 18:59
  3. Does NMIT work with S60 3rd Ed FP2 SDK?
    By stas_m in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2008-04-07, 10:39
  4. S60 3rd Edition SDK FP2 Installation
    By AbrahamDavid in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2008-04-03, 10:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×