Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-1362

Rest API Refactor Appears to have broken BlueprintsServlet

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: BLAZEGRAPH_RELEASE_1_5_1
    • Fix Version/s: BLAZEGRAPH_RELEASE_1_5_2
    • Component/s: None
    • Labels:
      None

      Description

      The BlueprintsPostTask appears to be broken. This task is to investigate the exception below.

      Follow the blueprints / Gremlin setup to replicate.

      java.util.concurrent.ExecutionException: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only
              at java.util.concurrent.FutureTask.report(FutureTask.java:122)
              at java.util.concurrent.FutureTask.get(FutureTask.java:188)
              at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:281)
              at com.bigdata.blueprints.webapp.BlueprintsServlet.doPost(BlueprintsServlet.java:87)
              at com.bigdata.blueprints.webapp.BlueprintsServlet.doPostRequest(BlueprintsServlet.java:168)
              at com.bigdata.rdf.sail.webapp.RESTServlet.doPost(RESTServlet.java:272)
              at com.bigdata.rdf.sail.webapp.MultiTenancyServlet.doPost(MultiTenancyServlet.java:138)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
              at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
              at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only
              at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:120)
              at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:146)
              at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:99)
              at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.java:68)
              at java.util.concurrent.FutureTask.run(FutureTask.java:262)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              ... 1 more
      Caused by: org.openrdf.sail.SailException: Read-only
              at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.assertWritableConn(BigdataSail.java:3657)
              at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.rollback(BigdataSail.java:3317)
              at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:117)
              ... 7 more
      

        Activity

        Show
        beebs Brad Bebee added a comment - fixed in https://github.com/SYSTAP/bigdata/commit/2382e82426896877b97a7fa8f801ed3bee29a949
        Hide
        bryanthompson bryanthompson added a comment -

        @beebs Please test the following code change:

        Old:

                    submitApiTask(
                            new BlueprintsPostTask(req, resp, getNamespace(req),
                                    getTimestamp(req))).get();
        

        New:

                    submitApiTask(
                            new BlueprintsPostTask(req, resp, getNamespace(req),
                                    ITx.UNISOLATED)).get();
        

        The default for getTimestamp(req) is to return the value of

        getConfig(getServletContext()).timestamp;
        

        That will typically be a read-only view of the data.

        Show
        bryanthompson bryanthompson added a comment - @beebs Please test the following code change: Old: submitApiTask( new BlueprintsPostTask(req, resp, getNamespace(req), getTimestamp(req))).get(); New: submitApiTask( new BlueprintsPostTask(req, resp, getNamespace(req), ITx.UNISOLATED)).get(); The default for getTimestamp(req) is to return the value of getConfig(getServletContext()).timestamp; That will typically be a read-only view of the data.
        Hide
        beebs Brad Bebee added a comment -

        This is in the current master. I have validated the same behavior with and without group commit.

        1. Checkout master.
        2. In one window, "ant start-blazegraph".
        3. In another, window.

        ant gremlin
        ./ant-build/gremlin-groovy-2.5.0/bin/gremlin.sh
        gremlin> import com.bigdata.blueprints.* 
        gremlin> g = new BigdataGraphClient("http://localhost:9999/bigdata/sparql") 
        gremlin> g.loadGraphML("./ant-build/gremlin-groovy-2.5.0/data/graph-example-1.xml")
        

        The Exception is generated on the server and returns an error to the client.

             [java] ERROR: BigdataRDFServlet.java:196: cause=java.util.concurrent.ExecutionException: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only
             [java] java.util.concurrent.ExecutionException: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only
             [java] 	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
             [java] 	at java.util.concurrent.FutureTask.get(FutureTask.java:188)
             [java] 	at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:281)
             [java] 	at com.bigdata.blueprints.webapp.BlueprintsServlet.doPost(BlueprintsServlet.java:87)
             [java] 	at com.bigdata.blueprints.webapp.BlueprintsServlet.doPostRequest(BlueprintsServlet.java:168)
             [java] 	at com.bigdata.rdf.sail.webapp.RESTServlet.doPost(RESTServlet.java:272)
             [java] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
             [java] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
             [java] 	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
             [java] 	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
             [java] 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
             [java] 	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
             [java] 	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
             [java] 	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
             [java] 	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
             [java] 	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
             [java] 	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
             [java] 	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
             [java] 	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
             [java] 	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
             [java] 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
             [java] 	at org.eclipse.jetty.server.Server.handle(Server.java:497)
             [java] 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
             [java] 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
             [java] 	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
             [java] 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
             [java] 	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
             [java] 	at java.lang.Thread.run(Thread.java:745)
             [java] Caused by: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only
             [java] 	at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:120)
             [java] 	at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:146)
             [java] 	at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:99)
             [java] 	at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.java:68)
             [java] 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
             [java] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
             [java] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
             [java] 	... 1 more
             [java] Caused by: org.openrdf.sail.SailException: Read-only
             [java] 	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.assertWritableConn(BigdataSail.java:3657)
             [java] 	at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.rollback(BigdataSail.java:3317)
             [java] 	at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:117)
             [java] 	... 7 more
        
        Show
        beebs Brad Bebee added a comment - This is in the current master. I have validated the same behavior with and without group commit. 1. Checkout master. 2. In one window, "ant start-blazegraph". 3. In another, window. ant gremlin ./ant-build/gremlin-groovy-2.5.0/bin/gremlin.sh gremlin> import com.bigdata.blueprints.* gremlin> g = new BigdataGraphClient( "http: //localhost:9999/bigdata/sparql" ) gremlin> g.loadGraphML( "./ant-build/gremlin-groovy-2.5.0/data/graph-example-1.xml" ) The Exception is generated on the server and returns an error to the client. [java] ERROR: BigdataRDFServlet.java:196: cause=java.util.concurrent.ExecutionException: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only [java] java.util.concurrent.ExecutionException: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only [java] at java.util.concurrent.FutureTask.report(FutureTask.java:122) [java] at java.util.concurrent.FutureTask.get(FutureTask.java:188) [java] at com.bigdata.rdf.sail.webapp.BigdataServlet.submitApiTask(BigdataServlet.java:281) [java] at com.bigdata.blueprints.webapp.BlueprintsServlet.doPost(BlueprintsServlet.java:87) [java] at com.bigdata.blueprints.webapp.BlueprintsServlet.doPostRequest(BlueprintsServlet.java:168) [java] at com.bigdata.rdf.sail.webapp.RESTServlet.doPost(RESTServlet.java:272) [java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [java] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [java] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769) [java] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [java] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [java] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [java] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [java] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125) [java] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [java] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [java] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059) [java] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [java] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [java] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [java] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [java] at org.eclipse.jetty.server.Server.handle(Server.java:497) [java] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) [java] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248) [java] at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [java] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610) [java] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539) [java] at java.lang. Thread .run( Thread .java:745) [java] Caused by: org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: Read-only [java] at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:120) [java] at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:146) [java] at com.bigdata.blueprints.webapp.BlueprintsServlet$BlueprintsPostTask.call(BlueprintsServlet.java:99) [java] at com.bigdata.rdf.task.ApiTaskForIndexManager.call(ApiTaskForIndexManager.java:68) [java] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [java] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [java] ... 1 more [java] Caused by: org.openrdf.sail.SailException: Read-only [java] at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.assertWritableConn(BigdataSail.java:3657) [java] at com.bigdata.rdf.sail.BigdataSail$BigdataSailConnection.rollback(BigdataSail.java:3317) [java] at org.openrdf.repository.sail.SailRepositoryConnection.rollback(SailRepositoryConnection.java:117) [java] ... 7 more
        Hide
        bryanthompson bryanthompson added a comment -

        Yes. It is following the correct pattern. I had already modified that servlet when the pattern changed.

        What else needs to be resolved for this ticket? Is there a test that is failing?

        Show
        bryanthompson bryanthompson added a comment - Yes. It is following the correct pattern. I had already modified that servlet when the pattern changed. What else needs to be resolved for this ticket? Is there a test that is failing?
        Hide
        beebs Brad Bebee added a comment -

        bryanthompson Can you please take a quick look at this BlueprintsServlet API task and see if it needs to be updated based on the API refactoring you did?

        private static class BlueprintsPostTask extends AbstractRestApiTask<Void> {
        
                public BlueprintsPostTask(HttpServletRequest req,
                        HttpServletResponse resp, String namespace, long timestamp) {
        
                    super(req, resp, namespace, timestamp);
        
                }
        
                @Override
                public boolean isReadOnly() {
                    return false;
                }
        
                @Override
                public Void call() throws Exception {
        
                    final long begin = System.currentTimeMillis();
                    
                    BigdataSailRepositoryConnection conn = null;
                    boolean success = false;
                    try {
        
                        conn = getConnection();
                        
                        final BigdataGraphBulkLoad graph = new BigdataGraphBulkLoad(conn);
        
                        GraphMLReader.inputGraph(graph, req.getInputStream());
                        
                        graph.commit();
                        
                        success = true;
                        
                        final long nmodified = graph.getMutationCountLastCommit();
        
                        final long elapsed = System.currentTimeMillis() - begin;
                        
                        reportModifiedCount(nmodified, elapsed);
        
                        // Done.
                        return null;
        
                    } finally {
        
                        if (conn != null) {
        
                            if (!success)
                                conn.rollback();
        
                            conn.close();
        
                        }
        
                    }
        
                }
        
            }
        
        Show
        beebs Brad Bebee added a comment - bryanthompson Can you please take a quick look at this BlueprintsServlet API task and see if it needs to be updated based on the API refactoring you did? private static class BlueprintsPostTask extends AbstractRestApiTask< Void > { public BlueprintsPostTask(HttpServletRequest req, HttpServletResponse resp, String namespace, long timestamp) { super (req, resp, namespace, timestamp); } @Override public boolean isReadOnly() { return false ; } @Override public Void call() throws Exception { final long begin = System .currentTimeMillis(); BigdataSailRepositoryConnection conn = null ; boolean success = false ; try { conn = getConnection(); final BigdataGraphBulkLoad graph = new BigdataGraphBulkLoad(conn); GraphMLReader.inputGraph(graph, req.getInputStream()); graph.commit(); success = true ; final long nmodified = graph.getMutationCountLastCommit(); final long elapsed = System .currentTimeMillis() - begin; reportModifiedCount(nmodified, elapsed); // Done. return null ; } finally { if (conn != null ) { if (!success) conn.rollback(); conn.close(); } } } }
        Hide
        bryanthompson bryanthompson added a comment -

        @beebs - What is the status of this ticket? Should it be assigned to the 1.5.2 or 1.5.3 release?

        Show
        bryanthompson bryanthompson added a comment - @beebs - What is the status of this ticket? Should it be assigned to the 1.5.2 or 1.5.3 release?

          People

          • Assignee:
            beebs Brad Bebee
            Reporter:
            beebs Brad Bebee
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: