Uploaded image for project: 'Zeppelin'
  1. Zeppelin
  2. ZEPPELIN-5885

IOException: Fail to clone note

    XMLWordPrintableJSON

Details

    Description

      I have problems running clone notes concurrently.

      The test code:

      package com.test.zeppelin;import kong.unirest.HttpResponse;
      import kong.unirest.JsonNode;
      import kong.unirest.Unirest;
      import kong.unirest.json.JSONObject;
      import org.apache.commons.text.StringEscapeUtils;
      import org.apache.zeppelin.client.ClientConfig;
      import org.apache.zeppelin.client.ZeppelinClient;public class ZeppelinClientTest
      {
          public static void main(String[] args) throws Exception
          {
              final ClientConfig config = new ClientConfig("http://23.134.136.201:8080");
              final ZeppelinClient zeppelinClient = new ZeppelinClient(config);        for (int i = 0; i < 10; i++)
              {
                  new Thread(new Runnable() {
                      @Override
                      public void run() {
                          for (int j = 0; j < 1000; j++) {
                              try {
                                  cloneNote("2HSUP6HYY", "", "/test/cloneNote" + System.currentTimeMillis());
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                          }
                      }
                  }).start();
              }
          }    /**
           * @param noteId 
           * @param userName
           * @param noteName
           * @throws Exception      */
          public static String cloneNote(String noteId, String userName, String noteName) throws Exception
          {
              JsonNode jsonNode = null;        try
              {
                  JSONObject bodyObject = new JSONObject();
                  bodyObject.put("name", noteName);
                  HttpResponse<JsonNode> response = Unirest.post("/notebook/{noteId}").routeParam("noteId", noteId).body(bodyObject.toString()).asJson();
         
                  jsonNode = response.getBody();
              }
              catch (Exception e)
              {
                  throw new Exception("clone note failed.", e);
              }        return jsonNode.getObject().getString("body");
          }
      } 

       

      The error is reported as follows

      ERROR [2023-03-01 11:35:45,619] ({qtp398690014-16} WebApplicationExceptionMapper.java[toResponse]:49) - Error response
      java.util.ConcurrentModificationException
          at java.util.HashMap$HashIterator.nextNode(HashMap.java:1442)
          at java.util.HashMap$EntryIterator.next(HashMap.java:1476)
          at java.util.HashMap$EntryIterator.next(HashMap.java:1474)
          at org.apache.zeppelin.notebook.NotebookAuthorizationInfoSaving.<init>(NotebookAuthorizationInfoSaving.java:39)
          at org.apache.zeppelin.notebook.AuthorizationService.saveNoteAuth(AuthorizationService.java:109)
          at org.apache.zeppelin.notebook.Notebook.createNote(Notebook.java:258)
          at org.apache.zeppelin.notebook.Notebook.createNote(Notebook.java:220)
          at org.apache.zeppelin.notebook.Notebook.cloneNote(Notebook.java:322)
          at org.apache.zeppelin.service.NotebookService.cloneNote(NotebookService.java:290)
          at org.apache.zeppelin.rest.NotebookRestApi.cloneNote(NotebookRestApi.java:454)
          at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
          at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
          at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
          at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
          at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
          at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
          at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
          at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
          at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
          at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
          at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
          at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
          at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
          at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)
          at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)
          at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
          at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1651)
          at org.apache.zeppelin.server.CorsFilter.doFilter(CorsFilter.java:64)
          at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1638)
          at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:567)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
          at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
          at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
          at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
          at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507)
          at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
          at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
          at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292)
          at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
          at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
          at io.micrometer.core.instrument.binder.jetty.TimedHandler.handle(TimedHandler.java:120)
          at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
          at org.eclipse.jetty.server.Server.handle(Server.java:501)
          at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
          at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
          at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
          at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
          at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
          at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
          at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
          at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
          at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
          at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
          at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
          at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
          at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
          at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
          at java.lang.Thread.run(Thread.java:748) 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              qinbo qinbo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: