Mono frustrations
I’m porting Voron to Mono (currently testing on Ubuntu). I’m using Mono 3.2.8, FWIW, and working in MonoDevelop.
So far, I have run into the following tangles that are annoying. Attempting to write to memory that is write protected results in null reference exception, instead of access violation exception. I suspect that this is done because NRE is generated on any SIGSEGV, but that led me to a very different path of discovery.
Also, consider the following code:
using System.IO;
using System.IO.Compression;
namespace HelloWorld
{
class MainClass
{
public static void Main (string[] args)
{
new ZipArchive (new MemoryStream ());
}
}
}
This results in the following error:
Unhandled Exception:
System.NotImplementedException: The requested feature is not implemented.
at HelloWorld.MainClass.Main (System.String[] args) [0x00006] in /home/ayende/HelloWorld/HelloWorld/Program.cs:11
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: The requested feature is not implemented.
at HelloWorld.MainClass.Main (System.String[] args) [0x00006] in /home/ayende/HelloWorld/HelloWorld/Program.cs:11
This is annoying in that it isn’t implemented, but worse from my point of view is that I don’t see any ZipArchive in the stack trace. That made me think that it was my code that was throwing this.
Comments
Mono 3 is pretty neglected from a server point of view.
We have issues with Nancy where our Mono build will randomly crash for no reason on the travis CI builds.
I think Grumpy has run into a couple of issues where Mono was just not implemented at all, or returned true and had no real implementation so he's had to send PRs to fix it.
You're in for a world of pain :)
Then there's the random runtime crashes.
The 2nd issue sounds like inlining. Should happen on the CLR in exactly the same way.
Not desirable, though. Would be nice if all throw sites preserved their original containing method.
Fortunately, the SP.NET team has full Mono compatibility as an important goal for ASP.NET vNext. Hopefully this will mean better stability.
3.2.8 is a bit old. You should consider using recent versions.
the last version is 3.10 and there is a lot of new functionalities. If I am not wrong, the zip was implemented in the last version. There are some servers that allow you to install the last mono on Ubuntu too, using the apt-get.
Daniel, Yes, I moved to 3.10.x and we got much better behavior.
Ayende, I marked you in one tweet with Miguel (the creator of the Mono and Xamarin Co-Founder), so you can exchange some ideas or check how to workaround about some points. Good luck!
Semi-Serious question... why bother porting to Mono? It's too slow on Linux to be an effective server.
Look at the TechEmpower benchmarks. Mono is consistently one of the slowest programming stacks out there.
When can we expect a HibernatingMono from you, sir?
JDice, Because I want to be able to run on Linux, and that is pretty much the only option we have.
Kyle, likely never, not in our skill set, or something that we care to do.
Paul, You can specify Parameter (in which case it is required) or ParameterOrDefault (in which case you can provide a default value).
@JDice that benchmark site is pretty bad. Not even worth remembering that it exists.
You'd be better off porting it to C.
Ronnie, At last count, RavenDB's code base exceeded 657 KLoC. That isn't really viable to port, and C isn't a good language for something like RavenDB And trying to write Voron only in C won't really help, because we actually care about RavenDB itself, not just Voron.
Comment preview