more G-Labs products

Author Topic: tls in HG?  (Read 3138 times)

September 27, 2014, 01:42:43 AM
Read 3138 times

haitch

  • Guest
I have been seeing this error on my RPI installation of HG.  It seems to be a mono issue according to the link below.

https://bugzilla.novell.com/show_bug.cgi?id=419989

Any suggestions on how to resolve this or if this is HG related?

Code: [Select]
wrong maximal instruction length of instruction tls_get (expected 8, got 24)
* Assertion: should not be reached at mini-arm.c:5341

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Delegate.CreateDelegate_internal (System.Type,object,System.Reflection.MethodInfo,bool) <0xffffffff>
  at System.Delegate.CreateDelegate (System.Type,object,System.Reflection.MethodInfo,bool,bool) <0x0080f>
  at System.Delegate.CreateDelegate (System.Type,object,System.Reflection.MethodInfo) <0x00033>
  at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type,object) <0x00043>
  at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate () <0x0007f>
  at System.Linq.Expressions.Compiler.LambdaCompiler.Compile (System.Linq.Expressions.LambdaExpression,System.Runtime.CompilerServices.DebugInfoGenerator) <0x0009b>
  at System.Linq.Expressions.LambdaExpression.Compile () <0x00017>
  at Microsoft.Scripting.Interpreter.LightDelegateCreator.Compile (object) <0x00277>
  at System.Threading.Tasks.TaskActionInvoker/ActionObjectInvoke.Invoke (System.Threading.Tasks.Task,object,System.Threading.Tasks.Task) <0x00033>
  at System.Threading.Tasks.Task.InnerInvoke () <0x0007f>
  at System.Threading.Tasks.Task.ThreadStart () <0x0023f>
  at System.Threading.Tasks.Task.Execute () <0x00013>
  at System.Threading.Tasks.TpScheduler.TaskExecuterCallback (object) <0x0004f>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

Code: [Select]
pi@raspberrypi ~ $ mono -V
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. [url=http://www.mono-project.com]www.mono-project.com[/url]
TLS:           __thread
SIGSEGV:       normal
Notifications: epoll
Architecture:  armel,vfp+hard
Disabled:      none
Misc:          softdebug
LLVM:          supported, not enabled.
GC:            sgen
pi@raspberrypi ~ $ dpkg -l homegenie
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version               Architecture          Description
+++-=================================-=====================-=====================-=======================================================================
ii  homegenie                         1.00-r403             all                   
             Open Source Home Automation Server in a "Internet Of Thin

September 27, 2014, 01:50:25 AM
Reply #1

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Are you using python? I've seen a similar problem and perhaps it has something to do with the python engine and mono.
If this is the issue, you may migrate the code to javascript (but for using events/delegates you need the latest hg release).

g.

September 27, 2014, 01:58:49 AM
Reply #2

haitch

  • Guest
Yes, I am using python.  I don't code much in javascript and even less in C#.  I guess I will have to live with it for now.

October 02, 2014, 02:28:03 PM
Reply #3

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hello haitch,

Python and Ruby engines have been just updated in latest testing release (r415):

https://sourceforge.net/projects/homegenie/files/testing/

Let me know if this release solves the bug.

Cheers,
g.

October 04, 2014, 02:18:00 AM
Reply #4

haitch

  • Guest
Hi Gene,

I tried again with r415 and the same issue occurred.  So I went a head and built mono from source on the RPI and HG has been running for an hour without crashing.   Apparently the fix here never made it into the RPI build of mono.

https://bugzilla.novell.com/show_bug.cgi?id=419989

I tried testing with r415 but I could not untar the archive.

 
Code: [Select]
$ tar zxf homegenie_1_00_beta_r415.tgz

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now

Before building mono I made the following change to fix the tls issue.  It is odd that arm is set to 8 when i386 and i686 are set to 32.  I am stuck building mono from source till this is resolved upstream.

Code: [Select]
$ git diff
diff --git a/mono/mini/cpu-arm.md b/mono/mini/cpu-arm.md
index 367cb5d..e9a8ade 100644
--- a/mono/mini/cpu-arm.md
+++ b/mono/mini/cpu-arm.md
@@ -211,7 +211,7 @@ sbb_imm: dest:i src1:i len:12
 br_reg: src1:i len:8
 bigmul: len:8 dest:l src1:i src2:i
 bigmul_un: len:8 dest:l src1:i src2:i
-tls_get: len:8 dest:i clob:c
+tls_get: len:32 dest:i clob:c
 
 # 32 bit opcodes
 int_add: dest:i src1:i src2:i len:4

mono version
Code: [Select]
$ mono -V
Mono JIT compiler version 3.6.0 ((no/f540f8a Fri Oct  3 13:17:44 CDT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. [url=http://www.mono-project.com]www.mono-project.com[/url]
TLS:           __thread
SIGSEGV:       normal
Notifications: epoll
Architecture:  armel,vfp+hard
Disabled:      none
Misc:          softdebug
LLVM:          supported, not enabled.
GC:            sgen

October 04, 2014, 09:24:13 AM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Seems it to be a problem with mono and BBB?
With official arm debian mono (3.2.8) there is no such problem on RPi and BPi.

Cheers,
g.

October 04, 2014, 05:40:28 PM
Reply #6

haitch

  • Guest
I am testing on my RPI.

October 04, 2014, 05:58:58 PM
Reply #7

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Are you running homegenie sd card?

g.

October 05, 2014, 01:44:38 AM
Reply #8

haitch

  • Guest
I had been running raspbain along with the HG all.deb from source forge.  I went a head and installed the HG RPI image and I get the same results.

Code: [Select]
wrong maximal instruction length of instruction tls_get (expected 8, got 24)
* Assertion: should not be reached at mini-arm.c:5341

Does the HG RPI image use the debian version of mono or are you building that from source?  It looks like the TLS issue has to be resolved upstream by the mono maintainers.

Code: [Select]
$ mono -V
Mono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. [url=http://www.mono-project.com]www.mono-project.com[/url]
TLS:           __thread
SIGSEGV:       normal
Notifications: epoll
Architecture:  armel,vfp+hard
Disabled:      none
Misc:          softdebug
LLVM:          supported, not enabled.
GC:            sgen

October 06, 2014, 12:23:59 AM
Reply #9

haitch

  • Guest
So a commit was pushed to the mono master branch for the tls issue above,  It is unlikely this will make into the debian repos anytime soon.  I will have to run a local version of mono for now.

https://github.com/mono/mono/commit/9e573872f0480ce7cf6468fc70e436d7bac56f61