question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when file or folder from import gets modified (Memory Corrupt...)

See original GitHub issue

Environment

  • 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:closed
  • Created 3 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
filmorcommented, Jan 19, 2021

Could you test whether this occurs on the current master as well?

0reactions
ArtruneTransparacommented, Apr 3, 2021

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

motion crashes on file import
If the problem persists: 1) Delete Motion preferences, as they may have become corrupted, and that will cause subsequent crashes.
Read more >
Attempted to read or write protected memory. This is often ...
Go to project properties of the console application project (Alternately you can select the project file in solution explorer and press Alt + ......
Read more >
BSOD crashes
Open Windows File Explorer. Navigate to C:\Windows\Minidump Copy any minidump files onto your Desktop, then zip those up. Upload the zip file ......
Read more >
How to fix: Error copying file or folder, A device attached ...
1. Restart the iPhone – Always Works. Yes, that's all you need to do, restart it and then take it slow, move one...
Read more >
Crashes when importing a large collection of files
I imported a year, and PSU was able to at least recognize the folder and file names before crashing. I then reopen PSU...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found