1

Vaadin 14

  1. We went live with the Vaadin application. This is my first time going live. When we try to reload the whole page with the multiples tab (fill content from DB). This error comes only when load increases on the server like (10+ people). When one or two-person using the application no such error/exception comes.

Below is one of the codes where this error comes:

private void reloadAssignmentButton_onClick(final ClickEvent<Button> event)
{
    try
    {
        this.clearAllLayouts();
        this.makeAllTabsInVisible();
        AssignmentFileDashboardView.log.info(UI.getCurrent().getSession().getAttribute(ConfigProperties.SESSION_KEY)
            + "::AssignmentFileDashboardView:::reloadAssignmentButton_onClick:::::CAN_FILE_NUMBER"
            + UI.getCurrent().getSession().getAttribute(ConfigProperties.CAN_FILE_NUMBER).toString());
        this.loadAssignment(
            Long.parseLong(UI.getCurrent().getSession()
                .getAttribute(ConfigProperties.CAN_FILE_NUMBER).toString()));
        AssignmentFileDashboardView.tabs.setSelectedTab(AssignmentFileDashboardView.assignmentTab);
    }
    catch(final Exception e)
    {
        AssignmentFileDashboardView.log
            .error(UI.getCurrent().getSession().getAttribute(ConfigProperties.SESSION_KEY)
                + "::AssignmentFileDashBoardView::assignmentRefreshButton_buttonClick::error:: " + e.getMessage()
                + e.getStackTrace(), e);
        
    }
    
}

This is my tomcat configuration:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="30000" redirectPort="8443" maxThreads="1000" minSpareThreads="50" acceptCount="300" enableLookUps="false" maxKeepAliveRequest = "1"/>
  1. Clicking these tabs some time stops working. Again with one or two users, it works fine but sometimes stops working.

  2. Sometimes I click on the tab and page load blank. again no problem when 1 or 2 users use it.

(Initially, I thought the tab might be having an issue and I change the tab to multiple buttons thinking the button will always call click event no matter what but now button also sometimes doing the same thing.)

We are live please help me. Thanks in advance.

Prashant Kumar
  • 145
  • 1
  • 11
  • 1
    Errors like this usually arise when you run your UI manipulating code outside of the current "request" (where Vaadin takes care for locking the session for you). Are you running said code asynchronously by any means? – cfrick Oct 07 '20 at 14:50
  • Yes, 2 tabs view using one table. And I think in many views it is happening. – Prashant Kumar Oct 07 '20 at 15:00
  • I don't understand how that implies async ops? Anyway you should read up on acessing the UI outside of the request: https://vaadin.com/docs/v14/flow/advanced/tutorial-push-access.html – cfrick Oct 07 '20 at 15:10
  • Even I don't know what is happening. I read that document. I don't know how to use that. I came to this link https://vaadin.com/forum/thread/8760508/13862974 do you think this will work? – Prashant Kumar Oct 07 '20 at 15:19
  • placing @Push and in parameter making it manual will that works? – Prashant Kumar Oct 07 '20 at 17:07
  • 1
    No it will not (if only make things worse). You are most likely accessing the session, when it's not locked. You have to manually lock the session. The push doc only explains the problem (code outside the request changing the UI). – cfrick Oct 07 '20 at 17:27
  • Does this answer your question? [Need locking when call VaadinSession getAttribute in Vaadin 7](https://stackoverflow.com/questions/21777067/need-locking-when-call-vaadinsession-getattribute-in-vaadin-7) – cfrick Oct 07 '20 at 17:33
  • 3
    Please include the full exception stacktrace – Leif Åstrand Oct 08 '20 at 04:50

1 Answers1

0
  1. I had UI that was a parent page.
  2. That Parent Page had a Vertical Layout in which child pages were opening.
  3. This parent page had some buttons (that needed to show and hide by the child pages events), tabs (that needed to show and hide by the child pages events), labels(that needed to update by the child pages events) and stuff like that.
  4. In order to do all these updates I made the parents "Vaadin Components" static as I cannot create an object of parents page as we needed to update those while it was opened.

In my case, Having "Static" Vaadin components gave me this issue and many others. With this scenario, one person working didn't give any issue. But when went on production it made my life miserable.

Learning: Never try to make the Vaadin component "Static". In fact, try to stay away from the "static" keyword as much as possible (If you don't know the consequences, in this case it was me).

Prashant Kumar
  • 145
  • 1
  • 11