Atmosphere / nettosphere

A Java WebSocket/HTTP server based on the Atmosphere and Netty Framework
http://async-io.org/
321 stars 81 forks source link

BridgeRuntime requestAttributes concurrecy issues #119

Closed Azukovskij closed 5 years ago

Azukovskij commented 8 years ago

BridgeRuntime.createAtmosphereRequest sets final Map<String, Object> attributes = new HashMap<String, Object>(); into AtmosphereRequestImpl.Builder .attributes(attributes) This causes ConcurrentModificationException when multiple websocket requests are send to atmosphere: |java.util.ConcurrentModificationException:null | atjava.util.HashMap$HashIterator.nextNode(HashMap.java:1429)~[na:1.8.0_66] | atjava.util.HashMap$KeyIterator.next(HashMap.java:1453)~[na:1.8.0_66] | atjava.util.Collections$UnmodifiableCollection$1.next(Collections.java:1042)~[na:1.8.0_66] | atjava.util.AbstractCollection.addAll(AbstractCollection.java:343)~[na:1.8.0_66] | atorg.atmosphere.cpr.AtmosphereRequestImpl.getAttributeNames(AtmosphereRequestImpl.java:846)~[atmosphere-runtime-2.4.1.7.jar!/:2.4.1.7] | atorg.atmosphere.cpr.AtmosphereRequestImpl.getHeaderNames(AtmosphereRequestImpl.java:275)~[atmosphere-runtime-2.4.1.7.jar!/:2.4.1.7] | atjavax.servlet.http.HttpServletRequestWrapper.getHeaderNames(HttpServletRequestWrapper.java:108)~[geronimo-servlet_3.0_spec-1.0.jar!/:1.0] | atcom.sun.jersey.spi.container.servlet.WebComponent.getHeaders(WebComponent.java:879)~[jersey-servlet-1.19.jar!/:1.19] | atcom.sun.jersey.spi.container.servlet.WebComponent.createRequest(WebComponent.java:446)~[jersey-servlet-1.19.jar!/:1.19] | atcom.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:373)~[jersey-servlet-1.19.jar!/:1.19] | atcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)~[jersey-servlet-1.19.jar!/:1.19] | atcom.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)~[jersey-servlet-1.19.jar!/:1.19] | atjavax.servlet.http.HttpServlet.service(HttpServlet.java:668)~[geronimo-servlet_3.0_spec-1.0.jar!/:1.0] ConcurrentHashMap should be used on BridgeRuntime:496

jfarcand commented 8 years ago

Pull request welcomed!