Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1235

When a N1QL request timed out (timeout) wrong exception received

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.3.8, 2.3.9
    • Fix Version/s: 2.4.0
    • Component/s: library
    • Labels:
      None

      Description

      Trying to access Azure env and the port is closed, N1QL query timed out.
      on fiddler I can see
      [Fiddler] The connection to '10.3.0.4' failed. <br />Error: TimedOut (0x274c). <br />System.Net.Sockets.SocketException A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.3.0.4:8093

      However on Visual Studio i'm getting the following exception on the result:
      Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Couchbase.N1QL.QueryResultData`1[System.Object]' because the type requires a JSON object (e.g.

      {"name":"value"}

      ) to deserialize correctly.
      To fix this error either change the JSON to a JSON object (e.g.

      {"name":"value"}

      ) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
      Path '', line 1, position 1.

      Tried it with 2.3.8 and with 2.3.9 with bucket and cluster queries with authentication.

      The sample code i've been using:
      };

      var credentials = new ClusterCredentials
      {
      ClusterUsername = "Administrator",
      ClusterPassword = "password",
      BucketCredentials = new Dictionary<string, string>
      {

      { "travel-sample", "" }

      // bucketName, bucketPassword
      }

      };

      const string query = "SELECT * FROM `travel-sample` LIMIT 10";

      var cluster = new Cluster(cc);
      cluster.Authenticate(credentials);

      var bucket = cluster.OpenBucket("travel-sample");
      var result1 = bucket.Get<String>("airline_10");

      Console.WriteLine(result1);

      try
      {
      var result = cluster.Query<dynamic>(query);
      foreach (var row in result.Rows)

      { Console.WriteLine(row); }

      }
      catch (Exception ex)

      { Console.WriteLine("EXCEPTION!! " + ex.Message); }

      Console.Read();

      }
      }

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

          Hide
          jmorris Jeff Morris added a comment -

          Thanks for reporting, Roi.

          Show
          jmorris Jeff Morris added a comment - Thanks for reporting, Roi.
          Hide
          jmorris Jeff Morris added a comment - - edited

          Moving out to 2.4.0 due to merge cutoff being yesterday 11/22/2016 (short week - Thanksgiving Holiday)

          Show
          jmorris Jeff Morris added a comment - - edited Moving out to 2.4.0 due to merge cutoff being yesterday 11/22/2016 (short week - Thanksgiving Holiday)
          Hide
          mike.goldsmith Michael Goldsmith added a comment -

          Roi Katz Jeff Morris
          I've done some investigation and that the deserialisation error message only occurs when Fiddler is running. Fiddler might be altering some of the content so the SDK then doesn't see as an error as expected.

          When fiddler is running line 378 doesn't throw an exception so we try to map the result using the DataMapper. When Fiddler is not running, an exception is thrown and the first catch block is executed.

          With fiddler running, the IQueryResult<T>.Exception contains:
          Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Couchbase.N1QL.QueryResultData`1[System.Object]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
          To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.

          Without fiddler:
          System.Net.Http.HttpRequestException: An error occurred while sending the request.
          ---> System.Net.WebException: Unable to connect to the remote server
          ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 10.112.151.101:8093

          Show
          mike.goldsmith Michael Goldsmith added a comment - Roi Katz Jeff Morris I've done some investigation and that the deserialisation error message only occurs when Fiddler is running. Fiddler might be altering some of the content so the SDK then doesn't see as an error as expected. When fiddler is running line 378 doesn't throw an exception so we try to map the result using the DataMapper. When Fiddler is not running, an exception is thrown and the first catch block is executed. With fiddler running, the IQueryResult<T>.Exception contains: Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON array (e.g. [1,2,3] ) into type 'Couchbase.N1QL.QueryResultData`1 [System.Object] ' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Without fiddler: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 10.112.151.101:8093
          Hide
          mike.goldsmith Michael Goldsmith added a comment -

          The exception that is returned when the N1QL port is blocked is appropriate but looks like Fiddler is preventing the normal exception from being thrown so a Json deserialization error is thrown instead.

          Show
          mike.goldsmith Michael Goldsmith added a comment - The exception that is returned when the N1QL port is blocked is appropriate but looks like Fiddler is preventing the normal exception from being thrown so a Json deserialization error is thrown instead.

            People

            • Assignee:
              mike.goldsmith Michael Goldsmith
              Reporter:
              roi.katz Roi Katz
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.