Crash when file or folder from import gets modified (Memory Corrupt...)
See original GitHub issueEnvironment
- Pythonnet version: 2.5.1
- Python version: 3.8
- Operating System: Win10, WinServer (2019,2016)
- .NET Runtime: 4.7
Details
-
Describe what you were trying to get done. I have a webservice that invokes a python.py file and gets its result, it works fine, the webservice is hosted in IIS, however whenever I change something from the file or folder where the python file I imported is it corrupts the memory and I have to restart the app pool or restart iis, To import the file I just use:
Py.Import(INTERFACE_FILE_NAME);
Is there some fundamental thing I’m missing?This is the error message I get, it seems to be crashing when the .py file has been modified and it tries import it again. :
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Python.Runtime.Runtime.PyImport_ImportModule(String name) at Python.Runtime.Runtime.Initialize(Boolean initSigs) at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize()
What I’ve tried:
What hasn’t worked: Py.Import PyModule.FromString (Access Violations…)
What has worked: Using any of the import methods but stopping the app pool, editing file and restarting the app pool (I don’t like this option)
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (8 by maintainers)
Top GitHub Comments
Could you test whether this occurs on the current master as well?
@lostmsu Right, thanks. It seems settled for now but I’ll keep an eye open.
And for anyone wondering or using IIS: any modification to the files inside the bin folder will result in Recycled App Pools. More here