> -----Original Message-----
> From: Niki Dokovski [mailto:nick...@gmail.com]
> Sent: Saturday, October 19, 2013 10:06 AM
> To: Tomcat Developers List
> Subject: Re: websocket connection (at startup) between 2 webapps in same
> Tomcat 7.0.47 instance hangs indefinitely
> 
> On Sat, Oct 19, 2013 at 4:26 PM, Bob DeRemer
> <bob.dere...@thingworx.com>wrote:
> 
> >
> >
> > > -----Original Message-----
> > > From: Niki Dokovski [mailto:nick...@gmail.com]
> > > Sent: Saturday, October 19, 2013 9:24 AM
> > > To: Tomcat Developers List
> > > Subject: Re: websocket connection (at startup) between 2 webapps in
> > > same Tomcat 7.0.47 instance hangs indefinitely
> > >
> > > On Sat, Oct 19, 2013 at 4:20 PM, Niki Dokovski <nick...@gmail.com>
> > wrote:
> > >
> > > >
> > > >
> > > >
> > > > On Sat, Oct 19, 2013 at 12:09 AM, Bob DeRemer
> > > <bob.dere...@thingworx.com>wrote:
> > > >
> > > >>  Hi Guys,****
> > > >>
> > > >> ** **
> > > >>
> > > >> In our implementation, we have a gateway app that uses jsr
> > > >> websockets to communication with our main application server.  In
> > > >> a small system, we want to run them both on a single Tomcat
> > > >> instance using the same Tomcat NIO connector, but directing to
> > > >> different respective WS paths.  This works fine if you deploy the
> > > >> MAIN first, then the GW
> > > >> - so that MAIN is already up and running.  If you restart Tomcat
> > > >> when both webapps are deployed - and the GW
> > > >> (client) starts first, it hangs indefinitely in the following
> > > >> code trying to establish a WS connection:
> > > >>
> > > >
> > > > Hi Bob,
> > > > Do you use the latest implementation? In your case, if got it
> > > > correctly, we have following:
> > > >
> >
> > This was with the latest TAGGED code (7.0.47), not trunk.  If this was
> > a known issue that's fixed in TRUNK, let me know and I'll test it out.
> >
> > Thx - bob
> >
> 
> I tested with a sample app that has an annotated server endpoint,an annotated
> client endpoint and a context listener.
> In the listener, I obtain instance of ServerContainer and try to connect to 
> the
> server endpoint.
> In both implementations (trunk and tc7.0.x) I got
> 
> "javax.websocket.DeploymentException: The HTTP response from the server
> [HTTP/1.1 404 Not
> Found] did not permit the HTTP upgrade to WebSocket"
> 
> as expected. However, the response processing is a blocking operation and can
> lead to the wait you describe. Can you isolate the case with a test app?
> Obviously I'm missing something.
> 

Hi Niki,

The key differences are:
* 2 separate web apps - where the client web app is starting before the server
* we are using a custom ClientEndpointConfig and ServerEndpointConfig classes, 
respectively, because we're passing some additional parameters in the HTTP 
upgrade headers
* the JSR-356 impl is not using annotation, but is using the following:

extends Endpoint implements Whole<ThingworxMessage>, ICommunicationChannel

Not sure what differences this makes.

-bob

> >
> >
> > >
> >
> > >
> > > >  1. a socket listening - Hence connections are processed
> > > >
> > >      2. missing application - Hence 404 Not Found status code is
> > expected I
> > > expect to have 404 response code on initial upgrade request
> > >
> > > cheers
> > > Niki
> > >
> > >
> > > (sorry for previous partial response, hit send by mistake)
> > >
> > >
> > > > ****
> > > >>
> > > >> ** **
> > > >>
> > > >> Is this a bug or a known limitation when a client/server in the
> > > >> same webapp try to connect at startup?****
> > > >>
> > > >> ** **
> > > >>
> > > >> Thanks****
> > > >>
> > > >> ** **
> > > >>
> > > >> "localhost-startStop-1" daemon prio=6 tid=0x000000000ef0f800
> > > >> nid=0x1624 waiting on condition [0x000000001046e000]****
> > > >>
> > > >>    java.lang.Thread.State: WAITING (parking)****
> > > >>
> > > >>        at sun.misc.Unsafe.park(Native Method)****
> > > >>
> > > >>        - parking to wait for  <0x00000007d6d98b18> (a
> > > >> java.util.concurrent.CountDownLatch$Sync)****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndChec
> > > >> kInt
> > > >> errupt(AbstractQueuedSynchronizer.java:834)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSh
> > > >> ared
> > > >> Interruptibly(AbstractQueuedSynchronizer.java:994)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShar
> > > >> edIn
> > > >> terruptibly(AbstractQueuedSynchronizer.java:1303)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.CountDownLatch.await(CountDownLatch.java:236
> > > >> )***
> > > >> *
> > > >>
> > > >>        at
> > > >> sun.nio.ch.PendingFuture.get(PendingFuture.java:180)****
> > > >>
> > > >>        at
> > > >>
> > >
> org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsW
> > > e
> > > >> bSocketContainer.java:568)
> > > >> ****
> > > >>
> > > >>        at
> > > >>
> > >
> org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsW
> > > e
> > > >> bSocketContainer.java:317)
> > > >> ****
> > > >>
> > > >>        at
> > > >> com.thingworx.core.communication.channels.jsr356.client.Jsr356Cli
> > > >> entC
> > > >> hannel.connect(Jsr356ClientChannel.java:57)
> > > >> ****
> > > >>
> > > >>        at
> > > >>
> > > com.thingworx.core.communication.endpoints.CommunicationEndpoint.con
> > > n
> > > >> ect(CommunicationEndpoint.java:186)
> > > >> ****
> > > >>
> > > >>        at
> > > >> com.thingworx.core.communication.CommunicationSubsystem.startSubs
> > > >> yste
> > > >> m(CommunicationSubsystem.java:88)
> > > >> ****
> > > >>
> > > >>        at
> > > >>
> com.thingworx.core.subsystems.SubsystemBase.start(SubsystemBase.java:
> > > >> 48)*
> > > >> ***
> > > >>
> > > >>        at
> > > >> com.thingworx.apiserver.APIServerManager.startSubsystem(APIServer
> > > >> Mana
> > > >> ger.java:92)
> > > >> ****
> > > >>
> > > >>        at
> > > >>
> com.thingworx.core.subsystems.SubsystemBase.start(SubsystemBase.java:
> > > >> 48)*
> > > >> ***
> > > >>
> > > >>        at
> > > >> com.thingworx.apiserver.Bootstrapper.contextInitialized(Bootstrapper.
> > > >> java:57)
> > > >> ****
> > > >>
> > > >>        at
> > > >> org.apache.catalina.core.StandardContext.listenerStart(StandardCo
> > > >> ntex
> > > >> t.java:4939)
> > > >> ****
> > > >>
> > > >>        at
> > > >> org.apache.catalina.core.StandardContext.startInternal(StandardCo
> > > >> ntex
> > > >> t.java:5434)
> > > >> ****
> > > >>
> > > >>        - locked <0x00000007da3e0308> (a
> > > >> org.apache.catalina.core.StandardContext)****
> > > >>
> > > >>        at
> > > >> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:1
> > > >> 50)*
> > > >> ***
> > > >>
> > > >>        - locked <0x00000007da3e0308> (a
> > > >> org.apache.catalina.core.StandardContext)****
> > > >>
> > > >>        at
> > > >> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
> > > >> java:1559)
> > > >> ****
> > > >>
> > > >>        at
> > > >> org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.
> > > >> java:1549)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.FutureTask.run(FutureTask.java:262)****
> > > >>
> > > >>        at
> > > >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
> > > >> java:1145)
> > > >> ****
> > > >>
> > > >>        at
> > > >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExec
> > > >> utor
> > > >> .java:615)
> > > >> ****
> > > >>
> > > >>        at java.lang.Thread.run(Thread.java:744)****
> > > >>
> > > >> ** **
> > > >>
> > > >>    Locked ownable synchronizers:****
> > > >>
> > > >>        - <0x00000007da3a7ab0> (a
> > > >> java.util.concurrent.ThreadPoolExecutor$Worker)****
> > > >>
> > > >> ** **
> > > >>
> > > >> ** **
> > > >>
> > > >> ** **
> > > >>
> > > >> *Bob DeRemer*
> > > >>
> > > >> *Senior Director, Architecture and Development*
> > > >>
> > > >> ** **
> > > >>
> > > >> [image: Description: Description: Description: Description:
> > > >> cid:image001.png@01CBE3DE.51A12030]****
> > > >>
> > > >> http://www.thingworx.com****
> > > >>
> > > >> Skype: bob.deremer.thingworx****
> > > >>
> > > >> O: 610.594.6200 x812****
> > > >>
> > > >> M: 717.881.3986****
> > > >>
> > > >> ** **
> > > >>
> > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For
> > additional commands, e-mail: dev-h...@tomcat.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to