Push 3.4 on IE9 with 6 p:socket kills outgoing ajax

UI Components for JSF
Post Reply
Catalyst
Posts: 13
Joined: 13 Jan 2012, 22:45

09 Sep 2012, 08:37

I've discovered a bug in the long-polling portion of push in IE9. When you add a 6th p:socket to a page outgoing ajax will no longer work. Interestingly another browser clicking the counter causes the IE9 one to update, so it seems like the sockets are open just blocking any future outgoing requests. Firefox and Chrome can happily carry on, even to the point of having 30 p:socket in the same page but they are using the ws: protocol not the long-polling.

I can reproduce this with the showcase as well as my app. In the showcase/push/counter.xhtml example I added 6 p:socket

Code: Select all

...
             <p:commandButton value="Click" actionListener="#{globalCounter.increment}" />
            </h:form>
            
                <p:socket onMessage="handleMessage" channel="/counter" />
                <p:socket onMessage="handleMessage" channel="/counter2" />
                <p:socket onMessage="handleMessage" channel="/counter3" />
                <p:socket onMessage="handleMessage" channel="/counter4" />
                <p:socket onMessage="handleMessage" channel="/counter5" />
                <p:socket onMessage="handleMessage" channel="/counter6" />

            <h3>Source</h3>
...
This breaks IE9, what you'll see is the spinner visibly stuck. If i comment out the last /counter6 channel then it works with just the 5. Doesn't matter if they are all on the same channel or not. This happens whether I use 127.0.0.1 or if i access by 192.168.x.x. from another computer on the network.

The source JS emitted on IE9 for counter6 is

Code: Select all

<script type="text/javascript">$(function() {widget_j_idt27 = new PrimeFaces.widget.Socket({url:'/prime-showcase/primepush/counter6',autoConnect:true,transport:'websocket',fallbackTransport:'long-polling',onMessage:handleMessage});});</script>
And on Chrome the source JS for counter6 is

Code: Select all

<script type="text/javascript">$(function() {widget_j_idt27 = new PrimeFaces.widget.Socket({url:'/prime-showcase/primepush/counter6;jsessionid=erlutwij24bwpd3mvd94ra8l',autoConnect:true,transport:'websocket',fallbackTransport:'long-polling',onMessage:handleMessage});});</script>
Also happens with 3.4 or 3.5-SNAPSHOT using Atmosphere 1.0.0.RC1 version that's in the showcase.

Any thoughts how we can get around this? I may be able to use only 2 p:socket but it would feel messy to eval the data to decide which js function to then call instead of the easy to read onmessage= attribute.

*EDIT* removed [BUG] from title, confirmed it's an IE browser limitation
Last edited by Catalyst on 02 Oct 2012, 22:22, edited 1 time in total.

User avatar
pmiklos
Posts: 21
Joined: 30 Aug 2012, 23:13

09 Sep 2012, 13:02

Hi,

I experienced the same behavior, or lack of behavior, on linux with Chrome and FF. I had 3 channels on a page and opening a second tab killed all ajax requests on both tabs. I associated this with long-polling and the maximum number of parallel connections a browser allows to open to a host. In my case it was the server which did not support websocket so the browser used long-polling at the end. I am not sure about IE9 but I have a feeling that it does not support websocket, instead atmosphere falls back on long-polling. Meanwhile, in case of Chrome and FF real websocket is used. But I am also not sure about the browser limitations of websocket connections.

Regards,
Peter
Primefaces 3.4.RC1

alnikolov
Posts: 2
Joined: 02 Dec 2011, 18:30

19 Sep 2012, 10:19

I do not think this is a bug. You are simply reaching the max active HTTP connections limit which on IE is much lower than other browsers.

In any case, I would never use more than 2 push connections in a web application. If you want more, you can multiplex several channels over a single connection wit some extra JavaScript on the client side.

Catalyst
Posts: 13
Joined: 13 Jan 2012, 22:45

02 Oct 2012, 22:25

After discussing with Jean-François we implemented the solution you also suggested which is to have a single socket per page and then used the data to store a key. js handles the multiplex to different methods based on the key. This has been working well for us for both websockets and long-polling.

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

16 Nov 2012, 13:01

Catalyst wrote:After discussing with Jean-François we implemented the solution you also suggested which is to have a single socket per page and then used the data to store a key. js handles the multiplex to different methods based on the key. This has been working well for us for both websockets and long-polling.
You could even just send the method/function call as a string and eval it...
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

jack9091
Posts: 1
Joined: 29 Nov 2012, 08:29

29 Nov 2012, 08:31

I would never use more than 2 push connections in a web application. If you want more, you can multiplex several channels over a single connection wit some extra JavaScript on the client side....
free testking questions free testking questions
cisco practice test cisco practice test
ase practice test ase practice test
642-359 practice test 642-359 practice test

kmart216
Posts: 4
Joined: 28 Jun 2012, 20:28

22 Feb 2013, 18:20

I see the same problem with just 1 or 2 sockets if I open multiple tabs on IE8/9. How can I get around this limitation?

Is there a way to force multiple sessions (tabs in IE) to use the same socket?

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

25 Feb 2013, 17:35

kmart216 wrote:Is there a way to force multiple sessions (tabs in IE) to use the same socket?
1. did you read all of the responses in this topic?
2. for a bit of background of multiple sessions per browser tab/window, click URL below, and click on all of the search results, and read.

http://lmgtfy.com/?q=jsf+balusc+new+ses ... tab+window

3. after you complete # 1 and # 2 above, search google for "atmosphere google groups", and scan the list there for an answer, since Catalyst (OP) said that he discussed this issue with Jeanfrancois (which, I assume, means that he asked a separate question on atmosphere google groups)
Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

FkJ
Posts: 183
Joined: 08 Jan 2010, 19:16

11 Mar 2014, 14:56

ChrisJacob wrote:I have downloaded the IE9 version in my PC last week. Ever since my system is very slow and get freezes when I browse net. This happened many times. Do these issues have anything in common? I am getting frustrated.








Thanks



derma microneedle roller
I have just made a test with IE 9 using the default configuration of p:socket and PushServlet with PF 4.0.9 and got the same problem, which happens with older IE too. http://forum.primefaces.org/viewtopic.php?f=10&t=36777

IE 10 and 11 worked fine.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider] and 23 guests