Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

Running an old IronPython on newer mono #1473

Closed
dsblank opened this issue Oct 18, 2016 · 21 comments
Closed

Running an old IronPython on newer mono #1473

dsblank opened this issue Oct 18, 2016 · 21 comments

Comments

@dsblank
Copy link

dsblank commented Oct 18, 2016

Running into a case with an old ironpython (2.9.9a0) on new mono (such as 4.2.1):

./ipy.exe
IronPython 2.9.9a0 DEBUG (2.9.0.0) on Mono 4.0.30319.17020 (64-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 + ""
Traceback (most recent call last):
TypeError: Value cannot be null.
Parameter name: method

Above the exception is handled somewhat, but with a weird error message. Any quick fix other than upgrading ironpython?

@slide
Copy link
Contributor

slide commented Oct 18, 2016

I don't even know what version of IPy that is...it seems like something built locally?

@dsblank
Copy link
Author

dsblank commented Oct 18, 2016

The problem occurs with later IronPython versions too, it seems. In any event, we found a workaround of supplying -X:ExceptionDetail (or setting that property in code).

@dsblank
Copy link
Author

dsblank commented Oct 18, 2016

Actually, we aren't crashing anymore, but aren't getting Python stack traces either.

@slide
Copy link
Contributor

slide commented Oct 18, 2016

What later versions of IronPython have you tried?

@dsblank
Copy link
Author

dsblank commented Oct 18, 2016

I haven't... working with another developer. He said that he is getting the same problem with NET35 with newer IronPython.

@dsblank
Copy link
Author

dsblank commented Oct 18, 2016

here is a full crash report: https://bitbucket.org/ipre/calico/issues/222/large-number-crash

@keithohara
Copy link

I updated our Python & Microsoft.Scripting DLL's and still have the same crash as Doug mentions. It appears to stem from GetStackTraces()

python>>> import sys
python>>> sys.version
'2.7.6 (IronPython 2.7.6.3 (2.7.6.3) on Mono 4.0.30319.42000 (64-bit))

@slide
Copy link
Contributor

slide commented Oct 18, 2016

Did you also update the standard library files? There were some updates to that as well in 2.7.6.3. Also, can you tell me what versions of mono and ironpython were previously working?

@keithohara
Copy link

keithohara commented Oct 18, 2016

I'll update the standard libraries as well, I didn't do that.

Currently using:

 mono --version
Mono JIT compiler version 4.6.1 (Stable 4.6.1.5/ef43c15 Wed Oct 12 09:10:37 UTC 2016)
Copyright (C) 2002-2014 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:            sgen

I'm not sure what I was using previously, but it was the Ubuntu 14.04 apt-get. (Maybe 3.2.8?) And as Doug mentioned, we are using an older (non-standard?) version of IronPython:

python>>> import sys
python>>> sys.version
'2.9.9a0 (IronPython 2.9.9a0 DEBUG (2.9.0.0) on Mono 4.0.30319.42000 (64-bit))'

@slozier
Copy link
Contributor

slozier commented Oct 18, 2016

@slide 2.9.9 is probably a build of the master branch.

@slide
Copy link
Contributor

slide commented Oct 18, 2016

@slozier Makes it pretty difficult to determine what code base was being used...

@keithohara
Copy link

keithohara commented Oct 18, 2016

OK, I've tried to recreate our issue with a simple embedding of IronPython:

using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;

using System;

public class Test
{
  static public void Main ()
  {
    Console.WriteLine ("Hello Mono World");
    ScriptEngine engine = Python.CreateEngine();

    ScriptSource source = engine.CreateScriptSourceFromString("1+\"2\"", SourceCodeKind.SingleStatement);

    try
      {
    source.Execute(engine.CreateScope());
      }
    catch(Exception e)
      {
    Microsoft.Scripting.Hosting.ExceptionOperations eo = engine.GetService<Microsoft.Scripting.Hosting.ExceptionOperations>();
    Console.WriteLine(eo.FormatException(e));
      }
  }
}

which results in:

Hello Mono World

Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: method
  at Microsoft.Scripting.Interpreter.InterpretedFrame.IsInterpretedFrame (System.Reflection.MethodBase method) [0x00034] in <79cfb7a2f3e64d08b5229af806595a85>:0 
  at Microsoft.Scripting.Interpreter.InterpretedFrame+<GroupStackFrames>d__27.MoveNext () [0x00050] in <79cfb7a2f3e64d08b5229af806595a85>:0 
  at IronPython.Runtime.Exceptions.PythonExceptions.GetDynamicStackFrames (System.Exception e) [0x000fd] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraceNoDetail (System.Exception e, System.Boolean& printedHeader) [0x00051] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraces (System.Exception e, System.Boolean& printedHeader) [0x000c9] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraces (System.Exception e) [0x00002] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatException (System.Exception exception) [0x00023] in <da43f94b98a64284b9b087d7c5165967>:0 
  at Microsoft.Scripting.Hosting.ExceptionOperations.FormatException (System.Exception exception) [0x00000] in <7cb5a539966b4a04a6d50e87834d41cf>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ExceptionOperations:FormatException (System.Exception)
  at Test.Main () [0x0003c] in <cd04668617a64140bec7fdd31c2138b3>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
Parameter name: method
  at Microsoft.Scripting.Interpreter.InterpretedFrame.IsInterpretedFrame (System.Reflection.MethodBase method) [0x00034] in <79cfb7a2f3e64d08b5229af806595a85>:0 
  at Microsoft.Scripting.Interpreter.InterpretedFrame+<GroupStackFrames>d__27.MoveNext () [0x00050] in <79cfb7a2f3e64d08b5229af806595a85>:0 
  at IronPython.Runtime.Exceptions.PythonExceptions.GetDynamicStackFrames (System.Exception e) [0x000fd] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraceNoDetail (System.Exception e, System.Boolean& printedHeader) [0x00051] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraces (System.Exception e, System.Boolean& printedHeader) [0x000c9] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatStackTraces (System.Exception e) [0x00002] in <da43f94b98a64284b9b087d7c5165967>:0 
  at IronPython.Runtime.PythonContext.FormatException (System.Exception exception) [0x00023] in <da43f94b98a64284b9b087d7c5165967>:0 
  at Microsoft.Scripting.Hosting.ExceptionOperations.FormatException (System.Exception exception) [0x00000] in <7cb5a539966b4a04a6d50e87834d41cf>:0 
  at (wrapper remoting-invoke-with-check) Microsoft.Scripting.Hosting.ExceptionOperations:FormatException (System.Exception)
  at Test.Main () [0x0003c] in <cd04668617a64140bec7fdd31c2138b3>:0 


Ubuntu 14.04
Mono JIT compiler version 4.6.1 (Stable 4.6.1.5/ef43c15 Wed Oct 12 09:10:37 UTC 2016)
IronPython-2.7.6.3

@slide
Copy link
Contributor

slide commented Oct 18, 2016

Does this same code work on Windows? Just trying to narrow down if it is something mono specific.

@slide
Copy link
Contributor

slide commented Oct 18, 2016

I just tested on Windows and it works (gets a correct stack trace). So, there is something specific to mono.

@slide
Copy link
Contributor

slide commented Oct 18, 2016

The issue seems to be that StackFrame.GetMethod() is returning null on Mono, but not on Windows (MS.NET). So, this could be an issue with Mono itself. We'll have to look into it further.

@keithohara
Copy link

Thanks for verifying it works on windows, I should have mentioned earlier we noticed the trouble on Mac OS X.

@slide
Copy link
Contributor

slide commented Oct 18, 2016

Just as an FYI, we're really just recently trying to get things work on Mono. We have a large portion of tests now running and passing on Mono, but there are sure to be issues like this one until we get a full support story going for Mono.

@keithohara
Copy link

Great to hear development is going strong!

We've been using IronPython on Mono from the start of our Calico project (2008 or so) and have had little headaches with that part of the Mono experience (Gtk on the other hand ...).

@keithohara
Copy link

keithohara commented Oct 18, 2016

I posted an issue on the Mono bug tracker:

https://bugzilla.xamarin.com/show_bug.cgi?id=45677

@dsblank
Copy link
Author

dsblank commented Oct 18, 2016

Thanks for all the work on this!

@slide
Copy link
Contributor

slide commented Jun 6, 2017

This issue was moved to IronLanguages/ironpython2#27

@slide slide closed this as completed Jun 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants