Server unable to process multiple requests
Hi, I am facing an issue with the VnCoreNLP server (the Java server) when I create multiple requests using goroutines. It would be great if you could please take a look:
ERROR VnCoreNLPServer - null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at vncorenlp.VnCoreNLPServer.annotate(VnCoreNLPServer.java:237)
at vncorenlp.VnCoreNLPServer.handle(VnCoreNLPServer.java:270)
at vncorenlp.VnCoreNLPServer.lambda$3(VnCoreNLPServer.java:184)
at spark.ResponseTransformerRouteImpl$1.handle(ResponseTransformerRouteImpl.java:47)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 10
at marmot.util.Encoder.append(Encoder.java:68)
at marmot.morph.MorphWeightVector.extractTransitionFeatures(MorphWeightVector.java:584)
at marmot.core.SimpleTagger.addTransitions(SimpleTagger.java:73)
at marmot.core.SimpleTagger.getSumLattice(SimpleTagger.java:407)
at marmot.core.SimpleTagger.tag_states(SimpleTagger.java:565)
at marmot.morph.MorphTagger.tagWithLemma(MorphTagger.java:49)
at vn.corenlp.postagger.PosTagger.tagSentence(PosTagger.java:52)
at vn.pipeline.Sentence.createWords(Sentence.java:60)
at vn.pipeline.Sentence.init(Sentence.java:53)
at vn.pipeline.Sentence.
Hi @alg0s, thank you for raising this issue,
I have tried multiprocessing on the official VnCoreNLP and failed so I guess the problem doesn't come from the wrapper side. Do you have any idea to tackle this one?
I believe the issue stems from the Java server, not the Python wrapper. The server doesn't seem to able to support multiple requests at the same time. Probably an upgrade in the server will be very helpful. It also doesn't not support large piece of text. I constantly receive WARN HttpParser - URI is too large >8192 which I would like to open another issue to keep track. Please let me know if you may upgrade the Java server. Unfortunately Java is not my domain. Thanks.
Hi @alg0s, thank you for raising this issue,
I have tried multiprocessing on the official VnCoreNLP and failed so I guess the problem doesn't come from the wrapper side. Do you have any idea to tackle this one?
I think the easiest way to fix is just simple. You can add a mutex lock to handle all request in queue. Now I write another wapper to wrap you server and it work. However, my wrapper is in Python because I am not Java dev anymore.
I think you can fix it in 2 lines of code. Add a global mutex lock then add a lock_guard in handle function.