Skip to content

Infinite loop/crash in root.LoadNames() #603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
barrybriggs opened this issue Jan 23, 2018 · 9 comments
Closed

Infinite loop/crash in root.LoadNames() #603

barrybriggs opened this issue Jan 23, 2018 · 9 comments

Comments

@barrybriggs
Copy link

barrybriggs commented Jan 23, 2018

Environment

  • Pythonnet version: 2.3
  • Python version: 3.6
  • Operating System: Windows

Details

(Pythonnet newbie). Trying to embed Pythonnet in a simple WPF app. Built Python.Runtime from source setting PYTHON3 and PYTHON36 on x64. Gets to GetCLRModule in importhook.cs and gets in infinite loop in root.LoadNames() line 98, ultimately crashes.

@den-run-ai
Copy link
Contributor

@barrybriggs how can someone reproduce this issue? Did you look at troubleshooting and installation wikis? Does this happen without WPF (in console)?

@barrybriggs
Copy link
Author

barrybriggs commented Jan 23, 2018

Thanks for the quick response. The code is very, very simple -- click on a WPF menu and the click handler calls PythonEngine.Initialize(). When I trace into root.LoadNames() there is the following code:

        {
            ManagedType m = null;
            foreach (string name in AssemblyManager.GetNames(_namespace))
            {
                cache.TryGetValue(name, out m);
                if (m == null)
                {
                    ManagedType attr = GetAttribute(name, true);
                }
            }
        }

The 'names' that it loads are: "FXAssembly", "ThisAssembly", "AssemblyRef", "", and then it starts trying to load what seems like types "_StaticArrayInitTypeSize=6" and then 8, and so on. It does this forever.

I have a feeling this may be because there is some required assembly or .py file or something like that it's looking for, but I can't find it.

UPDATE: I should add in my bin\debug folder there are: clr.py, clr.pyd, Python.Runtime.dll, python3.dll and python36.dll ... missing anything?

@den-run-ai
Copy link
Contributor

Do the demo apps work for you? Your example is still not reproducible.

@barrybriggs
Copy link
Author

npython loads. However, the demo apps do not run (assuming I typed the command correctly, which, as a Python newbie, I may not have):

>>> exec(open("Z:\demo\helloform.py").read())
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 8, in <module>
ModuleNotFoundError: No module named 'System'

PATH and PYTHONHOME are set correctly.

@dmitriyse
Copy link
Contributor

Please try "featured" branch. At least problems with "_StaticArrayInitTypeSize=6" types are eliminated.

@barrybriggs
Copy link
Author

@dmitriyse That seems to have cured the problem. Thanks!!

@den-run-ai
Copy link
Contributor

@dmitriyse what is the corresponding commit that fixes this "_StaticArrayInitTypeSize=6". I have not seen this issue before.

@dmitriyse
Copy link
Contributor

This is the corresponding PR #528

@den-run-ai
Copy link
Contributor

closed by #723

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants