pac3 icon indicating copy to clipboard operation
pac3 copied to clipboard

Extended use of PAC causes instant crashes? - PAC Backup System causes crashes.

Open TheReeb opened this issue 4 years ago • 19 comments

crash wat For a while I've been having this issue, where PAC crashes to desktop outright with seemingly no known cause to why it happens. The screenshot above is the only thing I managed to capture.

I have no idea what is causing this, but it always happens to me and apparently nobody else that I know of. It has become exceedingly annoying and is present in both master and develop branch.

Edit: Additional information added. See comments below.

TheReeb avatar Aug 02 '21 09:08 TheReeb

The 'not enough memory' message there makes it clear you're out of RAM

thegrb93 avatar Aug 02 '21 20:08 thegrb93

That's a good point, tho this pc has 16 GB of RAM. This should NOT be happening whatsoever. In that case there must be a memory leak going on

TheReeb avatar Aug 02 '21 20:08 TheReeb

x86 gmod is limited to 3GB of RAM. You could try x64 beta gmod to see if that solves the issue.

thegrb93 avatar Aug 02 '21 20:08 thegrb93

Hm, been a while since I used the x64 beta gmod since I don't play any beta versions. It's the one called x86-64 - Chromium IIRC, will test later and see if there's any difference.

TheReeb avatar Aug 02 '21 20:08 TheReeb

Pardon for necro-posting, but I have additional information that may be worth to look into.

It turns out it may be the backup system for pac causing these mysterious crashes on my end. I managed to capture a clear view of the error message that usually is shown, before crashing straight to desktop (see below) crashinfo 1

Following the trail, it appears this string of code is what causes these issues. (see below) crashinfo 2 (From the master branch, located in pac3/lua/pac3/editor/client/parts.lua)

For whatever reason, the backup system fails and the issue persists across workshop, master and develop branch.

TheReeb avatar Feb 05 '22 11:02 TheReeb

This error is expected if your lua state is full of memory. That doesn't make pac the cause of your lua state being full. I took a look at pace.Backup and didn't see any leaks.

thegrb93 avatar Feb 05 '22 12:02 thegrb93

This error is expected if your lua state is full of memory. That doesn't make pac the cause of your lua state being full. I took a look at pace.Backup and didn't see any leaks.

I am unsure what you are speaking of regarding "lua state", please explain.

Every single crash I've had through gmod the past 6 months is entirely because of PAC. I've even tried using it with NO ADDONS on except PAC. Same results every time - crash to desktop.

Dead certain it's a problem with the backup system here.

TheReeb avatar Feb 05 '22 12:02 TheReeb

You could try turning off backups maybe? add do return end at line 221 in your screenshot and see if it happens then

CapsAdmin avatar Feb 05 '22 16:02 CapsAdmin

You could try turning off backups maybe? add do return end at line 221 in your screenshot and see if it happens then

I will give it a try

TheReeb avatar Feb 05 '22 17:02 TheReeb

You could try turning off backups maybe? add do return end at line 221 in your screenshot and see if it happens then

I will give it a try

Doing this caused PAC to become completely unusable. I cannot attach parts to other bones on a playermodel, nor can I edit any settings on models, bones etc except position and angles (including positionoffset and angleoffset).

TheReeb avatar Feb 05 '22 17:02 TheReeb

Yeah an early return there is not good. On line 219 change if not not_from_editor then to if false then

thegrb93 avatar Feb 06 '22 02:02 thegrb93

Yeah an early return there is not good. On line 219 change if not not_from_editor then to if false then

Alright, will try this.

Edit: Do I keep the return? Because without it, backups are created when saving only. Or maybe that's intentional?

TheReeb avatar Feb 06 '22 11:02 TheReeb

Yeah an early return there is not good. On line 219 change if not not_from_editor then to if false then

Alright, will try this.

Edit: Do I keep the return? Because without it, backups are created when saving only. Or maybe that's intentional?

Noticed one thing off the bat with the current setup: Things are running much smoother than before, there are no backups generated when making changes to a PAC, right up until you save. It also removed other issues, such as gmod freezing periodically after making a change.

Overall, the editor feels a lot smoother to work in now. Now for the test run

TheReeb avatar Feb 06 '22 11:02 TheReeb

Noticed one thing off the bat with the current setup: Things are running much smoother than before, there are no backups generated when making changes to a PAC, right up until you save. It also removed other issues, such as gmod freezing periodically after making a change.

Overall, the editor feels a lot smoother to work in now. Now for the test run

I have been using pac for 3-4 hours straight, editing large and complex ones and so far, not a single crash has been encountered where I run out of memory. Not sure what else to say about this.

TheReeb avatar Feb 06 '22 14:02 TheReeb

So, after editing the code back to normal and using a clean data directory, it has been noted down that each time you edit a part (such as hiding it), it takes a second for a backup to be generated. This process creates lag that freezes gmod a second or more afterwards. Eventually a crash is bound to happen.

The outfit used for the experiment: ball spam.txt

TheReeb avatar Feb 06 '22 20:02 TheReeb

It's the undo system, not backups. Or probably both. Someone will need to investigate why it's so terrible if that's creating lag.

thegrb93 avatar Feb 07 '22 03:02 thegrb93

util.TableToJson is most likely the slow point

https://github.com/CapsAdmin/pac3/blob/develop/lua/pac3/editor/client/undo.lua#L93

thegrb93 avatar Feb 07 '22 04:02 thegrb93

Is it known if this memory leak issue can also cause the source-engine crash message "ed.alloc: no free edicts", it seems from the evidence so far that it could also be related to the issue as this crash is also related to memory handling.

Ek-Videogames avatar Feb 07 '22 20:02 Ek-Videogames

Is it known if this memory leak issue can also cause the source-engine crash message "ed.alloc: no free edicts", it seems from the evidence so far that it could also be related to the issue as this crash is also related to memory handling.

From the crashes I've had, never gotten this message personally.

TheReeb avatar Feb 07 '22 21:02 TheReeb