Skip to content

[BUG] Windows fatal exception: access violation #885

@Thoufak

Description

@Thoufak

First of all, I'm not sure if this a bug in Pyarmor, but I hope you can help me find out. I'm also using PyInstaller and have opened an issue there too. However, it doesn't look that the problem lies inside PyInstaller. Please also note that it would be very hard for me to test if the problem is present when I use just Pyarmor (without PyInstaller), because it can't be easily reproduced (see details below).

Sometimes a compiled version of my program will crash with this exception. It would look something like this:

Screenshot 2022-11-19 at 00 42 43

I’ve observed some notable features about when and how this happens, and I will list them below. Note that I’ve been using pyarmor + PyInstaller for over a year for this project, but I started seeing this problem only recently.

Rebuilding helps

If I see that the resulting exe has this issue, I can build it again using exactly the same source code and command. Nothing seems to be changing from my side. And this will produce a build which doesn’t have the crash, or it will now appear in a different place (see the next point).

It crashes on different lines.

If a specific build has this crash, and I don’t change any input parameters to my program, it will crash on the same line every time I start it (I mainly looked at the main thread stacktrace). In other words, this crash is very well reproducible within the same build. However, as I said, if I make a new build, this error will either be gone (most likely) or appear in a completely different place. I couldn’t find any meaningful similarities between the different lines of code I’ve seen my program crashing at.

Notice how I said "and I don’t change any input parameters to my program". I’ve once observed a crash inside a ‘for’ loop which is used to load lines from a text file. I managed to find the exact number of lines needed to crash my program. If the number of lines was below, it wouldn’t crash on that loop (but it probably will crash a bit later. I don’t remember this detail but I can check). It looks as though there's a defined number of "operations" that it does before crashing.

Also, it seems that this crash can happen in any place in the code. Sometimes it’s right at the start of the program, but sometimes you have to use it for a while to see the crash.

Visual Studio debugger

I’ve tried attaching a debugger from Visual Studio. I don’t think it produced any useful information, but I will attach the log anyway.
VSCode debugger.txt

More tracebacks examples

These are from different builds.

Screenshot 2022-11-10 at 02 57 35

Screenshot 2022-09-30 at 13 10 12

Versions

PyInstaller: 4.9
Pyarmor: 7.4.3
Python: 3.9.5
EXE built on: Windows 11 Home ARM64 (this is a machine from Parallels Desktop running on Mac M1 Pro)
Command for pyarmor: pyarmor pack src\safe_main.py -x="--advanced 2 --restrict=2" -e="-F -p="." --key "some_key" --icon Icon.ico --version-file VersionInfo.txt --hidden-import requests
(about 20 hidden imports omitted).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions