NG-Client Error (Warning was caused by: Access to component)

Forum to discuss the new web client version of Servoy.

NG-Client Error (Warning was caused by: Access to component)

Postby jeffrey.vandenhondel » Tue Jul 11, 2017 10:00 am

Our mobile NG-client can login and show a list, but after that almost everything you click you get the errors posted below. In the browser it just seems to not react. We don't know what these errors mean. contacts_tbl is a form.

Access to component svy_lvp_contacts_tbl property relatedFoundset denied (visible). Warning was caused by: Access to component contacts_tbl property null denied (visible)
2017-07-10 13:49  Executor,uuid:5a923a20-16a2-4dd4-a2bb-374cfa48c74d  WARN  org.sablo.websocket.WebsocketEndpoint  Warning: Access to component contacts_tbl property size denied (visible)  
2017-07-10 13:49  Executor,uuid:5a923a20-16a2-4dd4-a2bb-374cfa48c74d  WARN  org.sablo.websocket.WebsocketEndpoint  Warning: Access to component contacts_main property size denied (visible)
jeffrey.vandenhondel
 
Posts: 23
Joined: Thu Jul 28, 2016 9:05 am

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Tue Jul 11, 2017 10:26 am

Such errors can happen if client (browser) is trying to modify a property on server (same thing would happen if it's trying to execute a handler) for a component that from server's point of view is not visible.
So browser and server seem out-of-sync somehow.

Are you using any custom components / custom form containers (for example an custom impl. of something like a tab panel)?
What is the parent container of the form that gives this error? Is it a tab-panel/split pane/custom container component, is it the main browser window?

If you are using only Servoy-provided components you should create a case with a sample solution and steps to reproduce.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby jeffrey.vandenhondel » Tue Jul 11, 2017 1:45 pm

They strange thing is that whe did'nt change anything.

We have 3 servers.

Test
preTest (for our test customers)
Live (for our customters)

The only problems is the live server because then we have these error messages.
The specs of the servers are all the same:
Tomcat 8.5.15
JAVA JRE 1.8.0_131-b11

The only thing that is different is this:
Found on the live server tomcat web.xml

Code: Select all
 
<security-constraint>
    <web-resource-collection>
      <web-resource-name>Automatic SLL Forwarding</web-resource-name>
      <url-pattern>/</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>


I haven't created this part of the server so i don't know if this can cause the problem.
Last edited by jeffrey.vandenhondel on Wed Jul 12, 2017 12:30 pm, edited 1 time in total.
jeffrey.vandenhondel
 
Posts: 23
Joined: Thu Jul 28, 2016 9:05 am

Re: NG-Client Error (Warning was caused by: Access to compon

Postby sjoerd1337768711 » Wed Jul 12, 2017 12:18 pm

I have also a lot warnings about denied(visible). Andrei: Can you explain something more about the out-of-sync and how to prevent?

I use much custom components. Also a custom tab-panel (Material Design). With the framework forms are constantly shown and hided.
How to debug the out-of-sync? How to prevent components to be out-of-sync. Need there be some wait/timeout time in client javascript with showing/hiding forms in tabpanel?

I have also enhanced the servoy-table-component.. I see warnings of foundset and size access is denied.

I don't have the idea that it is blocking the application. Only much warnings in the log-files.
sjoerd1337768711
 
Posts: 15
Joined: Wed May 23, 2012 12:25 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Wed Jul 12, 2017 12:55 pm

Ok.

(unlikely) Someone else got these types of errors recently and in that case the errors happened because Servoy was being run from source (public sources on github) and a couple of projects needed the .ts files in two projects to be recompiled manually after pulling from Git. Just mentioned that to get it out of the way. I suppose you are running directly from a Servoy install so it does not affect you.

That being said, if you have custom tab-panels it is possible that the out-of-sync I was talking about happens if the tab-panel component shows a form - so it is present in the browser DOM but tells the server that that form was hidden. So any sequence of events that would lead to this situation can result in such messages in the log. Then anything that happens on that form that is present in the DOM on the browser - anything that needs to talk to the server will be denied on the server based on visibility.

In order to debug, you have to follow what that custom tab-panel does with svyServoyApi.formWillShow, svyServoyApi.hideForm and svyServoyApi.getFormUrl, and also see what the browser trying to do that is denied - and when - compared to the svyServoyApi calls.
To follow easier what the browser wants to do when it gets denied, you can - in browser console - enable more detailed Servoy logging:
____logProvider.debugEnabled(true)
____logProvider.debugLevel(____logProvider.SPAM) // for even more detailed logging
Make sure you switch the browser console to "verbose" logging level.
If that is not enough, to follow the svyServoyApi usage add some logging statements (either directly in the js or using conditional breakpoints) in the custom tab panel - it might be initially faster then using breakpoints.
It might be necessary to monitor the denied form's visibility on server-side as well. See when that form is shown/hidden in the solution compared to the above.

Any very complex scenarios in my head that might explain this I am trying to ignore :). You just have to debug what's really happening.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby jeffrey.vandenhondel » Wed Jul 12, 2017 2:05 pm

Hey Andrei,

I have tried these debug command but there is no logging.
jeffrey.vandenhondel
 
Posts: 23
Joined: Thu Jul 28, 2016 9:05 am

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Wed Jul 12, 2017 3:32 pm

For example in chrome this is what you should do:
debug_logging.png


This type of logging is present since 8.1.1. If you are using an even newer build it should work.
You do not have the required permissions to view the files attached to this post.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Wed Jul 12, 2017 3:33 pm

Btw. I am assuming you are the one who wrote the material tab-panel.
If you are not maybe it's better to let the one who did debug this.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby sjoerd1337768711 » Wed Jul 12, 2017 4:53 pm

Logging works perfect! I did not know that this was available. Something new learned today.

My problem with my md-tabpanel is solved. No warnings anymore of websocket.

I use a copy of the code of Servoy component: https://github.com/Servoy/angularmateri ... abpanel.js
It was working but giving errors on websocket. All forms were loaded on click on tabpanel: $scope.svyServoyapi.getFormUrl(tab.containedForm)

Now I changed my component to work like the standard tabpanel of Servoy.
https://github.com/Servoy/servoy-client ... abpanel.js

Cached forms:
if ($scope.model.selectedTab) {
// if the selected tab is already set then this is a reload of the form and we need to call formWillShow
delete $scope.model.selectedTab;
}

And also with the code with form in wait:
var formInWait = $scope.model.selectedTab.containsFormId;
$scope.waitingForServerVisibility[formInWait] = true;
var currentSelectedTab = $scope.model.selectedTab;
var promise = $scope.svyServoyapi.hideForm($scope.model.selectedTab.containsFormId,null,null,tab.containsFormId, tab.relationName);
if ($log.debugEnabled) $log.debug("svy * Will hide previously selected form (tab): " + $scope.model.selectedTab.containsFormId);
promise.then(function(ok) {
.... ETC


Still some more warning of websocket on other components.
sjoerd1337768711
 
Posts: 15
Joined: Wed May 23, 2012 12:25 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby sjoerd1337768711 » Thu Jul 13, 2017 10:49 am

After some logging I think that also the Bootstrap - tabless component is giving problems with "access to components" with hide forms.
Some components like for example the "table-component of Servoy" does have several watchers on ngclient. These watchers give "acces to component" errors when on serverside the form is not active anymore.

I use the tabless component to show forms. These forms are different templates with new tabless forms (5 different templates) into this.
When you switch the tabless form on upper level to a different template then it is the question what forms are hiding first by Servoy.
How to prevent that upperform is hided and you get on access problems and warnings at the child forms which are still active on client side for a few miliseconds?

Is it needed to clean-up the tabless forms first in template-forms and then switch on higher level the tabless panel?
sjoerd1337768711
 
Posts: 15
Joined: Wed May 23, 2012 12:25 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Thu Jul 13, 2017 11:41 am

Nice :).

Can you them make a pull request on that github repo with those fixes for https://github.com/Servoy/angularmateri ... abpanel.js ? Or at least report the issue there?

sjoerd1337768711 wrote:(...)
How to prevent that upperform is hided and you get on access problems and warnings at the child forms which are still active on client side for a few miliseconds?
Is it needed to clean-up the tabless forms first in template-forms and then switch on higher level the tabless panel?

Maybe you should create a case with a sample for this problem. My first thought was yes, component could hide the form on client first but problem is hide on server could be denied. So that is not really an option. So we really have to see what to do here. Can the extra calls in those milliseconds be avoided? If not, then maybe svyServoyApi.hideForm should do more (somehow work in multiple steps, or just ignore those incomming changes in those milliseconds without logging them - as if the form was really no longer in browser DOM anyway during that time).
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby sjoerd1337768711 » Sat Jul 15, 2017 11:56 am

I have solved my websocket warnings "access denied" with forms on the tablesspanel.

The servoy-api (hide-form / show-form) takes some time to load or onload. In the meanwhile the client is calling method getActiveTabUrl constantly (why this much of calls I don't know.? Because of all client/server communication with replicating browser/server state / form watchers ?). When the form is in a busy process of showing or hiding it will give "denied access" errors in the application server.

I changed the code like servoy-default-tabpanel. When a form is getting onshow or hide it put a waiting-status. When show/hide is ready the status is released. Other methods which are calling the forms on the server are checking first the waiting status and only run when the form/server is not busy with showing/hiding.

In my case I needed a reload form. When the main-template with tabless panel is the same as the previous but formstate on tabpanel changes I had problems that on the new forms the OnShow methods were not running on the server. With a ReloadForm of the main-template it is working normal. For changing the containedForm I have also made an API. I experienced that model-changes are not pushed to the client on the moment of call in the method but on the end when the server is ready with the complete method.

Andrei/Servoy: Can you check my code? I'm a little afraid that a form can get in a wait-status and gets in an endless waitingloop. Application could freeze on the client.

Code: Select all
angular.module('angularmaterialTablesspanel',['servoy']).directive('angularmaterialTablesspanel', ['$sabloApplication', '$q', function($sabloApplication, $q) { 

   return {
      restrict: 'E',
      scope: {
         model: "=svyModel",
         svyServoyapi: "=",
         handlers: "=svyHandlers",
         api: "=svyApi"
      },
      controller: function($scope, $element, $attrs) {

         var realContainedForm;
         var formWillShowCalled;
         
         $scope.waitingForServerVisibility = { }    // Used to wait for true of tab
         

         function setRealContainedForm (formname, relationname) {
            
            if (!$scope.waitingForServerVisibility[formname]){
                  
               if (formWillShowCalled != formname && formname) {
                  
                  $scope.waitingForServerVisibility[formname] = true;
                  formWillShowCalled = formname;
                  if ($scope.model.waitForData) {
                     $q.when($scope.svyServoyapi.formWillShow(formname, relationname)).then(function() {
                        realContainedForm = formname;
                        delete $scope.waitingForServerVisibility[formname];
                     });
                  } else {
                     $scope.svyServoyapi.formWillShow(formname, relationname).then(function() {
                        realContainedForm = formname;
                        delete $scope.waitingForServerVisibility[formname];
                     });
                  }
               }
            }
         }

         $scope.getActiveTabUrl = function() {
            if (realContainedForm && !$scope.waitingForServerVisibility[realContainedForm])
            {
               return $scope.svyServoyapi.getFormUrl(realContainedForm)
            } 
            return "";
         }

         setRealContainedForm($scope.model.containedForm, $scope.model.relationName);

         $scope.$watch("model.containedForm", function(newValue,oldValue) {
            if (newValue !== oldValue)
            {
               if (oldValue && !$scope.waitingForServerVisibility[oldValue]) {

                  $scope.waitingForServerVisibility[newValue] = true;
                  $scope.waitingForServerVisibility[oldValue] = true;
                  $scope.svyServoyapi.hideForm(oldValue,null,null,newValue,$scope.model.relationName,null).then(function(ok) {
                     realContainedForm = $scope.model.containedForm;
                     delete $scope.waitingForServerVisibility[newValue];
                     delete $scope.waitingForServerVisibility[oldValue];      
                  })
               }
               else if (newValue && !$scope.waitingForServerVisibility[newValue]) {
                  setRealContainedForm(newValue, $scope.model.relationName);
               }
            }   
         });

         $scope.$watch("model.visible", function(newValue,oldValue) {
            if ($scope.model.containedForm && newValue !== oldValue)
            {
               formWillShowCalled = realContainedForm = undefined;
               if (newValue)
               {
                  setRealContainedForm($scope.model.containedForm, $scope.model.relationName);
               }
               else
               {
                  $scope.svyServoyapi.hideForm($scope.model.containedForm);
               }   
            }   
         });

         $scope.getContainerStyle = function() {
            var height = 0;
            if ($scope.model.height)
            {
               height = $scope.model.height
            }
            else if ($scope.model.containedForm && $sabloApplication.hasFormStateWithData($scope.model.containedForm))
            {
               // for absolute form default height is design height, for responsive form default height is 0
               var formState = $sabloApplication.getFormStateEvenIfNotYetResolved($scope.model.containedForm);
               if (formState && formState.properties && formState.properties.absoluteLayout)
               {
                  height = formState.properties.designSize.height;
               }    
            }    
            return {position:"relative", minHeight:height+"px"};
         }

         $scope.showEditorHint = function()
         {
            return !$scope.model.containedForm && $element[0].getAttribute("svy-id") !== null;
         }

         $scope.api.SetContainedForm = function(_formname){
            $scope.model.containedForm = _formname
         }
         
         $scope.api.ReloadForm = function(_formname){
            if($scope.model.containedForm == _formname){
               if (!$scope.waitingForServerVisibility[_formname]) {
                  $scope.waitingForServerVisibility[_formname] = true;
                  $scope.svyServoyapi.hideForm(_formname,null,null,_formname,$scope.model.relationName,null).then(function(ok) {
                     realContainedForm = $scope.model.containedForm;
                     delete $scope.waitingForServerVisibility[_formname];      
                  })
               }
            }
            $scope.model.containedForm = _formname
         }
                     

      },
      templateUrl: 'angularmaterial/tablesspanel/tablesspanel.html'
   };
}]);
sjoerd1337768711
 
Posts: 15
Joined: Wed May 23, 2012 12:25 pm

Re: NG-Client Error (Warning was caused by: Access to compon

Postby Andrei Costescu » Mon Jul 17, 2017 9:09 am

Ok. I had a look. I don't know the contents of the template/server side js, so for some things I can only assume how they are meant to work.
I didn't work much with this sort of things, so any extra set of eyes is welcome.

  1. at lines 28 and 33: aren't both approaches doing the same thing (so both then and else of that if seem to be doing the same thing; so the if can be removed)? Or did you find that formWillShow does not always return a promise?
  2. at line 60: you don't seem to be treating hide deny from server properly. You always hide the old form/show the new form even if hide was denied on server.
  3. at line 81: you do hideForm($scope.model.containedForm) even if realContainedForm was previously null; so it could be that containedForm wasn't actually shown (so formWillShow or equivalent on server might not have been called on it for example if when swithing to containedForm old form hide returned false)
  4. always where you have a .then(successFunc) I would suggest you also treat the error situation, so .then(successHandlerFunc, errorHandlerFunc) (just in case it happens)

Did you create the pull req. (github fork + git push on forked repo + git pull req. for original repo) for the mdtabpanel and the case (if it's still needed) I mentioned in the last post?
You can create another pull req. to add your new material tabless to the public repo as well (if you want to do that) or to fix bootstrap tabless as needed.

We should really at least report some issues for all the problems even if you do not make pull requests - so that we don't leave them like this.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 905
Joined: Tue Jun 26, 2007 3:14 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests