Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-8133

Metadata search returns error on certain offsets

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: 4.1.0
    • Component/s: CDAP
    • Labels:
      None
    • Release Notes:
      Fixed an issue with metadata searches with certain offsets overflowing and returning an error.
    • Rank:
      1|hzzspz:

      Description

      When doing a metadata search with an offset of 1, for example: "GET /v3/namespaces/default/metadata/search?query=*&offset=1", I get an error message stating "end index (-2147483648) must not be negative".

      Additionally, this is reproducible if I use "GET /v3/namespaces/default/metadata/search?query=*&offset=1&limit=2147483647", which passes in the default value of limit explicitly.

      In fact, it appears that when the offset is <= total, this error occurs.

      Note, 214783647 is the maximum value for ints in Java.

      Stacktrace:

      2017-01-18 11:05:20,081 - ERROR [metadata.service-executor-13:c.c.c.c.HttpExceptionHandler@68] - Unexpected error: request=GET /v3/namespaces/default/metadata/search?query=*&offset=19 user=<null>:
      java.lang.IndexOutOfBoundsException: end index (-2147483630) must not be negative
      at com.google.common.base.Preconditions.checkPositionIndexes(Preconditions.java:388) ~[guava-13.0.1.jar:na]
      at com.google.common.collect.ImmutableList.subList(ImmutableList.java:371) ~[guava-13.0.1.jar:na]
      at co.cask.cdap.data2.metadata.store.DefaultMetadataStore.search(DefaultMetadataStore.java:443) ~[na:na]
      at co.cask.cdap.data2.metadata.store.DefaultMetadataStore.search(DefaultMetadataStore.java:393) ~[na:na]
      at co.cask.cdap.metadata.DefaultMetadataAdmin.search(DefaultMetadataAdmin.java:171) ~[na:na]
      at co.cask.cdap.metadata.MetadataHttpHandler.searchMetadata(MetadataHttpHandler.java:856) ~[na:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
      at co.cask.http.HttpMethodInfo.invoke(HttpMethodInfo.java:80) ~[netty-http-0.16.0.jar:na]
      at co.cask.http.HttpDispatcher.messageReceived(HttpDispatcher.java:38) [netty-http-0.16.0.jar:na]
      at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70) [netty-3.6.6.Final.jar:na]
      at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564) [netty-3.6.6.Final.jar:na]
      at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791) [netty-3.6.6.Final.jar:na]
      at org.jboss.netty.handler.execution.ChannelUpstreamEventRunnable.doRun(ChannelUpstreamEventRunnable.java:43) [netty-3.6.6.Final.jar:na]
      at org.jboss.netty.handler.execution.ChannelEventRunnable.run(ChannelEventRunnable.java:67) [netty-3.6.6.Final.jar:na]
      at org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor$ChildExecutor.run(OrderedMemoryAwareThreadPoolExecutor.java:314) [netty-3.6.6.Final.jar:na]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_112]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_112]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_112]

        Attachments

          Activity

            People

            • Assignee:
              denton Denton Liu
              Reporter:
              denton Denton Liu
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: