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

Race condition in Atmosphere when initializing two VaadinServlets at the same time #5026

Closed
vaadin-bot opened this issue Apr 2, 2014 · 3 comments
Labels

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @Artur-


One way to reproduce is to set a breakpoint in PushRequestHandler's constructor and DefaultBroadcasterFactory.lookup(Class,Object,boolean,boolean) . Then open two URLs mapped to different servlets, e.g. /integration and /run/BasicPush. The race condition comes from addAtmosphereHandler. Depending on which thread enters the synchronized block in lookup first, it either works or throws an exception:

Apr 2, 2014 7:58:26 PM org.atmosphere.cpr.AtmosphereFramework interceptor
INFO: Installed AtmosphereInterceptor  Track Message Size Interceptor using | with priority BEFORE_DEFAULT 
Apr 2, 2014 7:58:34 PM org.atmosphere.cpr.AtmosphereFramework configureBroadcaster
SEVERE: Unable to configure Broadcaster/Factory/Cache
java.lang.IllegalStateException: Broadcaster already exists /*. Use BroadcasterFactory.lookup instead
	at org.atmosphere.cpr.DefaultBroadcasterFactory.lookup(DefaultBroadcasterFactory.java:189)
	at org.atmosphere.cpr.DefaultBroadcasterFactory.get(DefaultBroadcasterFactory.java:121)
	at org.atmosphere.cpr.DefaultBroadcasterFactory.get(DefaultBroadcasterFactory.java:108)
	at org.atmosphere.cpr.AtmosphereFramework.configureBroadcaster(AtmosphereFramework.java:1041)
	at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:714)
	at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:616)
	at com.vaadin.server.communication.PushRequestHandler.<init>(PushRequestHandler.java:113)
	at com.vaadin.server.VaadinServletService.createRequestHandlers(VaadinServletService.java:92)
	at com.vaadin.server.VaadinService.init(VaadinService.java:179)
	at com.vaadin.server.VaadinServlet.createServletService(VaadinServlet.java:190)
	at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:96)
	at com.vaadin.server.LegacyVaadinServlet.init(LegacyVaadinServlet.java:48)
	at com.vaadin.launcher.ApplicationRunnerServlet.init(ApplicationRunnerServlet.java:60)
	at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:519)
	at org.eclipse.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:402)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:642)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
	at org.eclipse.jetty.server.Server.handle(Server.java:368)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:488)
	at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:932)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:994)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
	at java.lang.Thread.run(Thread.java:695)
Apr 2, 2014 7:58:34 PM org.atmosphere.cpr.AtmosphereFramework autoDetectWebSocketHandler
INFO: Auto detecting WebSocketHandler in /WEB-INF/classes/

Imported from https://dev.vaadin.com/ issue #13528

@vaadin-bot
Copy link
Collaborator Author

Originally by @Artur-


Atmosphere ticket: Atmosphere/atmosphere#1543

@vaadin-bot
Copy link
Collaborator Author

Originally by @Artur-


Fixed with a workaround until the Atmosphere issue is fixed

@vaadin-bot
Copy link
Collaborator Author

Originally by CodingFabian


The same code is in 7.1.x - i guess it should be backported?

@vaadin-bot vaadin-bot added the bug label Dec 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant