Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push long polling freeze UI #209

Closed
michahirsch opened this issue Mar 17, 2015 · 15 comments
Closed

Push long polling freeze UI #209

michahirsch opened this issue Mar 17, 2015 · 15 comments

Comments

@michahirsch
Copy link

Hi,

The push annotation with long-pooling freezes the Vaadin UI and I can see an endless vaadin load indicator.

Environment

  • Vaadin 7.4.1
  • vaadin-lazyquerycontainer 7.4.0.0
  • spring-boot-vaadin 0.0.4.RELEASE

I'm using also then LazyQueryContainer to load beans in Vaadin Tables, it seems that the first page is loading correctly and the entries are shown in the table but the vaadin load indicator is endless loading and flashing and the second page request is never be executed. It seems the whole Vaadin UI is freezing.

The Push request is on pending state and retrieving an response.
http://localhost:8080/UI/PUSH/?v-uiId=0&v-csrfToken=619d9a83-6b13-4584-b033-7a382b35fa4f&X-Atmosphere-tracking-id=1fd257c0-6394-4d03-82e0-ace9dd3516e0&X-Atmosphere-Framework=2.2.6.vaadin3-jquery&X-Atmosphere-Transport=streaming&X-Atmosphere-TrackMessageSize=true&Content-Type=application%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1426583600034

Do you have any Idea why the Vaadin UI is freezing and the Vaadin load indicator is endless loading/flashing?

Thanks,
Michael

@LukaszByczynski
Copy link
Contributor

I had same issues. Long polling hangs randomly page. I found workaround - reload page. Unfortunately, it's makes a user experience horrible fight with page reloads. After week of test we change push transport to Websocket. Current version 7.4.1 works without page hanging.

I think problem with long polling is located deeply in Vaadin. There is no reconnection after failed long poll reconnection request.

@peholmst
Copy link
Owner

We've run into that issue in our projects as well and we don't yet know what is causing it. Are you using Spring Security?

@michahirsch
Copy link
Author

yes I'm also using spring-security

@peholmst
Copy link
Owner

We have a suspicion that Spring Security's session handling could somehow be interfering with Vaadin (#203).

@michahirsch
Copy link
Author

um good indicator, it also happens that is randomly based where we start the application, on some computer it works totally fine, really interesting, maybe I'll do some investigating into the spring-security configuration thanks for the hint.

@peholmst
Copy link
Owner

@michahirsch Thanks, that would be much appreciated!

@michahirsch
Copy link
Author

Hi,

I guess it's not an spring-security problem, at least the problem I'm having. I modified the push-example a little bit by using long-polling and removing the thread which adds single entries to the Grid. Very easy example which lead into the endless vaadin loading indicator and the Grid is only filled until line 39. The weird thing is that in case the AMOUNT_NUMBERS is just e.g. 10 then I don't run into the endless loading indicator problem.

I will try to keep looking what's going on but maybe someone has a glue or an idea? The example is very easy and without spring-security.

Additional: Using Transport.WEBSOCKET the example works fine.

/*
 * Copyright 2015 The original authors Licensed under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
 * law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 * for the specific language governing permissions and limitations under the License.
 */
package org.vaadin.spring.samples.push;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.vaadin.annotations.Push;
import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Title;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.ui.Grid;
import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;

@Push( transport = Transport.LONG_POLLING )
@Title( "Push Demo" )
@SpringUI( )
@Theme( ValoTheme.THEME_NAME )
public class PushUI extends UI {

   private static final long   serialVersionUID = 3708190173011782944L;
   private static final Logger LOGGER           = LoggerFactory.getLogger( PushUI.class );

   private static final int    AMOUNT_NUMBERS   = 100;
   private static Random       rnd              = new Random();

   private Grid                grid;
   private IndexedContainer    measurements;

   @Override
   protected void init( final VaadinRequest vaadinRequest ) {
      measurements = new IndexedContainer();
      measurements.addContainerProperty( "Count", Integer.class, null );
      measurements.addContainerProperty( "Data", Integer.class, null );

      final List<Integer> numbers = getNumbers( AMOUNT_NUMBERS );

      for( int index = 0; index < numbers.size(); index++ ) {
         final Item item = measurements.getItem( measurements.addItem() );
         item.getItemProperty( "Count" ).setValue( index );
         item.getItemProperty( "Data" ).setValue( numbers.get( index ) );
      }

      grid = new Grid( measurements );
      grid.setSizeFull();
      setContent( grid );
      LOGGER.info( "init done" );
   }

   private List<Integer> getNumbers( final int amount ) {
      final List<Integer> retList = new ArrayList<>( amount );
      for( int index = 0; index < amount; index++ ) {
         retList.add( rnd.nextInt() );
      }
      return retList;
   }
}

image
image

@peholmst
Copy link
Owner

Could you try the sample with Vaadin 7.4.2? I heard it has some push fixes.

@michahirsch
Copy link
Author

I already tried the 7.4.2 because I also saw the issue was fixed there http://dev.vaadin.com/ticket/17074 but it still freezing also with the 7.4.2

@peholmst
Copy link
Owner

@michahirsch OK, then we're dealing with another problem. Thanks for investigating.

@ghost
Copy link

ghost commented Mar 23, 2015

I am also not using Spring Security, using long-polling, but still on 7.3.9. I get the freeze very randomly.

@ghost
Copy link

ghost commented Apr 9, 2015

I finally switched to 7.4.2, specifying @Push as is, accepting framework defaults (websockets). Cursory testing shows the application is working well.

@Artur-
Copy link

Artur- commented Apr 28, 2015

@michahirsch It seems like your application is never able to establish a long-polling connection to the server. If there is a proxy somewhere in between (does Spring have some kind of built-in proxy?), you are likely hitting https://dev.vaadin.com/ticket/17075.

@peholmst
Copy link
Owner

Is this problem still present?

@peholmst
Copy link
Owner

I have not run into this problem with the newer Vaadin versions, so I'm closing this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants