Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RavenDB client onlinux connecting to windows server using mono http

I've just tried connecting to my RavenDB windows instance from linux using mono. I'm getting a bizarre error with it, that seems to be mono related rather than raven related.

Here is my recreate code (works on windows):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Raven.Client.Document;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

            try
            {
                var store = new DocumentStore()
                                {
                                    ConnectionStringName = "RavenDB",
                                    EnlistInDistributedTransactions = false

                                };
                store.Initialize();

                using (var session = store.OpenSession("system-events"))
                {
                    session.Store(new { Name = "Test" });
                    session.SaveChanges();
                }
                Console.WriteLine("done");
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.ToString());
            }

            Console.ReadKey();


        }
    }
}

and my mono version:

chris@x-ngx4:~/click/beta/Debug$ mono --version
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            Included Boehm (with typed GC and Parallel Mark)

and the error:

chris@x-ngx4:~/click/beta/Debug$ mono ConsoleApplication2.exe
System.IO.IOException: Internal error (no progress possible) Flush
  at System.IO.Compression.DeflateStream.CheckResult (Int32 result, System.String where) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStream.Flush () [0x00000] in <filename unknown>:0
  at System.IO.Compression.GZipStream.Flush () [0x00000] in <filename unknown>:0
  at Raven.Abstractions.Connection.HttpRequestHelper.WriteDataToRequest (System.Net.HttpWebRequest req, System.String data, Boolean disableCompression) [0x00000] in <filename unknown>:0
  at Raven.Client.Connection.HttpJsonRequest.Write (System.String data) [0x00000] in <filename unknown>:0
  at Raven.Client.Connection.ServerClient.DirectBatch (IEnumerable`1 commandDatas, System.String operationUrl) [0x00000] in <filename unknown>:0
  at Raven.Client.Connection.ServerClient+<>c__DisplayClass68.<Batch>b__67 (System.String u) [0x00000] in <filename unknown>:0
  at Raven.Client.Connection.ReplicationInformer.TryOperation[BatchResult[]] (System.Func`2 operation, System.String operationUrl, Boolean avoidThrowing, Raven.Abstractions.Data.BatchResult[]& result) [0x00000] in <filename unknown>:0
like image 908
Chris Avatar asked Dec 13 '12 12:12

Chris


1 Answers

I think I found it. DeflateStream has extern references to zlib. If you look at the zlib header file, you will find some comments:

deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and deflate() can be called again with more input and more output space to continue compressing.

The message Internal error (no progress possible) is what DeflateStream returns when getting a Z_BUF_ERROR - but it doesn't continue, it treats it as a hard stop. It should treat it as a warning and continue. At least, that's my interpretation.

Can you raise this with the mono support team? I'm not active in that group. Thanks.

like image 129
Matt Johnson-Pint Avatar answered Sep 16 '22 12:09

Matt Johnson-Pint