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

Thread-safe PathRecorderBehaviour #50

Merged
merged 1 commit into from
Sep 26, 2016
Merged

Conversation

bentmann
Copy link
Contributor

@bentmann bentmann commented Sep 18, 2016

http://bamboo.s/browse/OSS-GOODIESF16-1

Pulled the below stack trace out of a sporadic test failure where concurrent client requests hit the server. Not really surprising given the employed ArrayListMultimap is documented to not be thread-safe.

javax.servlet.ServletException: 4
    at org.sonatype.goodies.httpfixture.server.jetty.impl.BehaviourServlet.behave(BehaviourServlet.java:64) [na:na]
    at org.sonatype.goodies.httpfixture.server.jetty.impl.BehaviourServlet.doGet(BehaviourServlet.java:50) [na:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [javax.servlet-api:3.1.0]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api:3.1.0]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:835) [org.eclipse.jetty.servlet:9.3.7.v20160115]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) [org.eclipse.jetty.servlet:9.3.7.v20160115]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) [org.eclipse.jetty.servlet:9.3.7.v20160115]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.Server.handle(Server.java:517) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) [org.eclipse.jetty.server:9.3.7.v20160115]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) [org.eclipse.jetty.io:9.3.7.v20160115]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [org.eclipse.jetty.io:9.3.7.v20160115]
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) [org.eclipse.jetty.io:9.3.7.v20160115]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) [org.eclipse.jetty.util:9.3.7.v20160115]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) [org.eclipse.jetty.util:9.3.7.v20160115]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) [org.eclipse.jetty.util:9.3.7.v20160115]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) [org.eclipse.jetty.util:9.3.7.v20160115]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
    at java.util.ArrayList.add(ArrayList.java:459) [na:1.8.0_45]
    at com.google.common.collect.AbstractMapBasedMultimap.put(AbstractMapBasedMultimap.java:202) [com.google.guava:18.0.0]
    at com.google.common.collect.AbstractListMultimap.put(AbstractListMultimap.java:100) [com.google.guava:18.0.0]
    at com.google.common.collect.ArrayListMultimap.put(ArrayListMultimap.java:66) [com.google.guava:18.0.0]
    at org.sonatype.goodies.httpfixture.server.jetty.behaviour.PathRecorderBehaviour.execute(PathRecorderBehaviour.java:45) [org.sonatype.goodies.httpfixture:2.2.0]
    at org.sonatype.goodies.httpfixture.server.jetty.impl.BehaviourServlet.behave(BehaviourServlet.java:58) [na:na]

@peterlynch
Copy link
Member

+1

1 similar comment
@fjmilens3
Copy link

+1

Copy link
Member

@dbradicich dbradicich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@bentmann bentmann merged commit 7169908 into master Sep 26, 2016
@bentmann bentmann deleted the thread-safe-path-recorder branch September 26, 2016 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants