You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232
    Vote Rating
    2
    thesilentman is on a distinguished road

      0  

    Default [FIXED-239][3.0r5286] several Ext.Direct bugs (Timeout, failure, actionfailed)

    [FIXED-239][3.0r5286] several Ext.Direct bugs (Timeout, failure, actionfailed)


    Ext version tested:
    • Ext 3.0.X____ rev 5286

    Adapter used:
    • ext

    css used:
    • only default ext-all.css



    Browser versions tested against:
    • FF3.5 (firebug 1.4.2 installed)

    Operating System:
    • Vista/Linux

    Description:
    • 1) Ext.direct seems not to honor the timeout config option. I tried to set the timeout to 10 sec for testing purposes as a submit config option as well as a form option.

      2) Ext.direct does not call the form's actionfailed event when either a timeout has occured or the server cannot be contacted temporarily

      3) Ext.direct does not call the submit's failure event when either a timeout has occured or the server cannot be contacted temporarily. I believe this to be the same problem as above

    Test Case:

    Code:
    /*
     * ! Ext JS Library 3.0+ Copyright(c) 2006-2009 Ext JS, LLC licensing@extjs.com
     * http://www.extjs.com/license
     */
    // This example illustrates how to load a FormPanel or BasicForm through
    // Ext.Direct.
    Ext.onReady(function() {
    			// Notice that Direct requests will batch together if they occur
    			// within the enableBuffer delay period (in milliseconds).
    			// Slow the buffering down from the default of 10ms to 100ms
    			Ext.app.REMOTING_API.enableBuffer = 100;
    			Ext.Direct.addProvider(Ext.app.REMOTING_API);
    
    			// provide feedback for any errors
    			Ext.QuickTips.init();
    
    			var basicInfo = new Ext.form.FormPanel({
    						// configs for FormPanel
    						title : 'Basic Information',
    						border : false,
    						padding : 10,
    						timeout: 10,
    						buttons : [{
    							text : 'Submit',
    							handler : function() {
    								basicInfo.getForm().submit({
    									params : {
    										foo : 'bar',
    										uid : 34
    									},
    									//timeout: 10,
    									success : function(object, action) {
    										console.debug('success', object, action);
    									},
    									failure : function(object, action) {
    										console.debug('failure', object, action);
    
    									}
    										});
    							}
    								}],
    						listeners : {
    							actioncomplete : function(object, action) {
    								console.debug('actioncomplete', object, action);
    							},
    							actionfailed : function(object, action) {
    								console.debug('actionfailed', object, action);
    							}
    						},
    						// configs apply to child items
    						defaults : {
    							anchor : '-20'
    						}, // provide some room on right for validation errors
    						defaultType : 'textfield',
    						items : [{
    									fieldLabel : 'Name',
    									name : 'name'
    								}, {
    									fieldLabel : 'Email',
    									msgTarget : 'side',
    									name : 'email'
    								}, {
    									fieldLabel : 'Company',
    									name : 'company'
    								}],
    
    						// configs for BasicForm
    						api : {
    							// The server-side method to call for load()
    							// requests
    							load : Profile.getBasicInfo,
    							// The server-side must mark the submit handler as a
    							// 'formHandler'
    							submit : Profile.updateBasicInfo
    						},
    						// specify the order for the passed params
    						paramOrder : ['uid', 'foo']
    					});
    
    			var phoneInfo = new Ext.form.FormPanel({
    						title : 'Phone Numbers',
    						border : false,
    						api : {
    							load : Profile.getPhoneInfo
    						},
    						padding : 10,
    						paramOrder : ['uid'],
    						defaultType : 'textfield',
    						defaults : {
    							anchor : '100%'
    						},
    						items : [{
    									fieldLabel : 'Office',
    									name : 'office'
    								}, {
    									fieldLabel : 'Cell',
    									name : 'cell'
    								}, {
    									fieldLabel : 'Home',
    									name : 'home'
    								}]
    					});
    
    			var locationInfo = new Ext.form.FormPanel({
    						title : 'Location Information',
    						border : false,
    						padding : 10,
    						api : {
    							load : Profile.getLocationInfo
    						},
    						paramOrder : ['uid'],
    						defaultType : 'textfield',
    						defaults : {
    							anchor : '100%'
    						},
    						items : [{
    									fieldLabel : 'Street',
    									name : 'street'
    								}, {
    									fieldLabel : 'City',
    									name : 'city'
    								}, {
    									fieldLabel : 'State',
    									name : 'state'
    								}, {
    									fieldLabel : 'Zip',
    									name : 'zip'
    								}]
    					});
    
    			var accordion = new Ext.Panel({
    						layout : 'accordion',
    						renderTo : Ext.getBody(),
    						title : 'My Profile',
    						width : 300,
    						height : 240,
    						items : [basicInfo, phoneInfo, locationInfo]
    					});
    
    			// load the forms (notice the load requests will get batched
    			// together)
    			basicInfo.getForm().load({
    						// pass 2 arguments to server side getBasicInfo method
    						// (len=2)
    						params : {
    							foo : 'bar',
    							uid : 34
    						}
    					});
    
    			phoneInfo.getForm().load({
    						params : {
    							uid : 5
    						}
    					});
    
    // defer this request just to simulate the request not getting batched
    			// since it exceeds to configured buffer
    			(function() {
    				locationInfo.getForm().load({
    							params : {
    								uid : 5
    							}
    						});
    			}).defer(200);
    
    			// rpc call
    			TestAction.doEcho('sample');
    
    		});

    Steps to reproduce the problem:
    Just replace the content of the examples/direct/direct-form.js file with the code provided above. Then let the form load it's data. I did tests with the submit function but I guess the problem also applies to the load function.
    • 1) The Timeout problem can be reproduced if you have a debugger for php that just stops execution at the router. If you don't, you have to put the sleep function with a high value somewhere to simulate a timeout.

      2) The 'failure' and 'actionfailed' events that shout be called upon surpassing the timeout should also be visible after you have run the timeout reproduction. The messages I have put to be displayed in the console are not displayed.

      3)The 'failure' and 'actionfailed' events that shout be called upon not being able to contact the server can be rerpoduced by loading the form completely, then stopping the httpd service and trying to submit the form. Result: The events are not called




    The result that was expected:
    • Timeout should be honored
    • submit.failure and form.actionfailed events should be called

    The result that occurs instead:
    • Timeout value is not being honored
    • submit.failure and form.actionfailed events are not being called

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,006
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    I've added a fix for respecting server exceptions.

    The timeout isn't respected because you're running it through the provider, there's no way to set it in a per call basis, especially if you're batching. However, I have added a timeout option to the provider, which can be used in the same as enableBuffer.

    Fix applied to svn in rev #5329 for patch release 3.0.2.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232
    Vote Rating
    2
    thesilentman is on a distinguished road

      0  

    Default


    Thanks for resolving this so fast Evan.

    Though, I am a little confused on the timeout issue.
    The timeout isn't respected because you're running it through the provider, there's no way to set it in a per call basis, especially if you're batching.
    I get this, but then why do we have the timeout option in the Action.Directsubmit config. Is there a way to run direct calls 'not' through the provider?

    Greets,
    Frank

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,006
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    No, there isn't, which is why the issue exists. All direct calls are marshalled through the single remoting provider.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1