0

I have an app, written in C# on Windows, but recompiled on Ubuntu 12.04 (32 bit), and running, issue free, in production, on Ubuntu 12.04 (64 bit).

I am using Mono 2.10.8.1, recompiled from source (as I needed to remove the Windows 64 WaitHandle maximum limitation, but that's a different story).

My problem is that, whilst it runs happily in 12.04 (service run by mono-service, hosted in supervisor) I am receiving the following Exception, when the service tries to start, on Ubuntu 14.04 (we are moving to a cloud hosted Linux instance, rather than locally hosting)

TypeInitializationException: An exception was throw$
at (wrapper managed-to-native) Mono.Unix.Native.Syscall:_L_ctermid ()
at Mono.Unix.Native.Syscall..cctor () [0x00000] in <filename unknown>:0\

(there is, apparently, an InnerException, but that's also a TypeInitializationException)

Apart from the release, the only other difference between the two installations (working 12.04 production, and not working 14.04 potential production) is that on 12.04 my binaries are in

~/theserviceimrunning/

whereas on the new box it's in

/opt/theserviceimrunning/

I wouldn't think there would be a difference between release, especially as I am using the same version of Mono, recompiled from tarball, but would this be an issue? If not, is there anything else I should be aware of?

johnc
  • 39,385
  • 37
  • 101
  • 139

1 Answers1

0

As it turned out, using nano to view the exception log was my first problem, as it 'hid' the real problem by not wrapping lines, and truncating them with a $.

The real exception was that I was missing libMonoPosixHelper.so, due to LD_LIBRARY_PATH not being added as an Environment Variable.

Unhandled Exception: System.TypeInitializationException: 
An exception was thrown by the type initializer for Mono.Unix.Native.Syscall ---
System.DllNotFoundException: libMonoPosixHelper.so

See this question for details and the fix.

Community
  • 1
  • 1
johnc
  • 39,385
  • 37
  • 101
  • 139
  • this is mainly because /opt is not a standard prefix, that's why you need to use LD_LIBRARY_PATH. If you used a standard prefix like /usr/local or /usr, you would not need to. – knocte May 19 '14 at 01:18
  • ( you may have used /opt because you read some mono wiki using it, but most likely you read this wiki page: http://mono-project.com/Parallel_Mono_Environments , which is for people with very special needs about running two mono installations at the same time) – knocte May 19 '14 at 01:20
  • @knocte, that was probably it. As we recompiled Mono itself (due to the waithandle limits), we then had the fun task of getting monodevelop to run happily against either the default install of mono or the recompiled one. We certainly did visit that wiki page, though, for sake of ease, eventually compiled our code on another Ubuntu instance, without the recompiled mono, and copied it over to the production one. Possibly /usr would be a better place for it, but it's running happily now on our cloud hosted server, so I'll leave it alone. – johnc May 19 '14 at 01:26