sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
803 stars 39 forks source link

[Build 3124] Crashed while saving my `sublime-syntax` modifications #1396

Closed evandrocoan closed 7 years ago

evandrocoan commented 8 years ago

[Build 3124] Crashed while saving my sublime-syntax modifications

May be related to: https://forum.sublimetext.com/t/st3-crashes-frequently-since-build-3124/23042

Summary

I just added a new scope for the my syntax-file, and ST suddenly closed and generated a dump file. This is the dump file '0d908c15-4582-4b56-a509-d6d38b9b873f.dmp': 0d908c15-4582-4b56-a509-d6d38b9b873f.zip

Expected behavior

Is expected to ST do not crash when saving my changes to a sublime-syntax file.

Actual behavior

The ST is crashing when saving my changes for a sublime-syntax file.

Steps to reproduce

  1. Open a syntax file.
  2. Add a new scope/context and save the file.
  3. ST luckily it will crash and generate a crash report, misfortunately it will not crash.

    Environment

    • Operating system and version:
    • [x] Windows 10
    • [ ] Mac OS ...
    • [ ] Linux ...
    • Sublime Text:
    • Build 3124 portable located on: D:\User\Applications\SoftwareVersioning\SublimeText

Update

I think it is not related to syntax files, but not something else unpredictable as some third part Installed Package doing something with the API causing the crash, as I experienced other unrelated crashes with the syntax files editing. Like more eight times since this initial report on Sep 22.

What I do after the crash is simply open sublime again. I do not remember about data loss or changes to my work spaces, except the undo command history lost.

wbond commented 8 years ago

Can you provide the changes to made that caused the crash?

evandrocoan commented 8 years ago

These were the changes: full_file_with_diff_changes.zip, this is the commit: https://github.com/evandrocoan/SublimeAmxxPawn/commit/6df860f3d246507433a8cd3cd822196593637eba

Note:

At the time, my workspace was very big like within 1000 files for indexing, involving C++ files and AmxxPawn.

image

wbond commented 8 years ago

Ok, I'll look into it when I get a chance

evandrocoan commented 7 years ago

I never got it happening anymore, closing it for now.

evandrocoan commented 7 years ago

Just crashed again, this is the new dump file: bd38c8a4-b452-499e-a0a2-407df878fc48.zip

  1. Like the fist time, now I was saving a code file, not a syntax file. But the import is, the only related event is the saving process.
    • It is important to mention, some times I save the file every minute, other times, each 10 seconds. So, on my day use, there are a lot of saving. I always use ctrl+s for saving.
  2. This time, and like the last, the windows Event View did not registered the crash, but Sublime Text created the above dump file.
  3. When I was using the build 3114, it had crashed some times, but I do not recall whether it was related to the saving process as it is now.

New dump file/crash on: 13/10/2016

This time I had saved a syntax file change. Was this:

Packages\amxmodx\AMXX-Pawn.sublime-syntax
103:         - match: \n

To this:

Packages\amxmodx\AMXX-Pawn.sublime-syntax
103:         - match: $

3c0ebcee-8b86-466f-a432-3d03ff2c989c.zip

deathaxe commented 7 years ago

I never experienced crashes, when working with syntax-files, but I can confirm there is something wrong with how sublime text handles changes to them.

When changing saving syntax files several times, ...

  1. sublime's memory usage increases from 30MB to about (300...400MB).
  2. you'll find several files like .5340.tmp in the cache directory of the syntax package.
evandrocoan commented 7 years ago

I think it is not related to syntax files, but not something else unpredictable. I experienced other crashes like more five since this initial report on Sep 22.

What I do after the crash is simply open sublime again. I do not remember about data loss or changes to my work spaces.

However, this other bug report changes as always happens after a program restart or project change:

  1. https://github.com/SublimeTextIssues/Core/issues/1379 _ Restore session, does not set the last scrool position after a project change, or sublime restart

I also got tired about post the dump file here. The Sublime Crash reporter should be updating them correctly as it always lunch after the crash.

FichteFoll commented 7 years ago

When changing syntax file, Sublime Text has to re-index all files in the current project using that syntax, meaning it has to parse them. I don't know what it does with the several tmp files, but memory and CPU usage increase is expected for a syntax of which you have many files in the current project.

The only 'crashes' related to editing syntax definitions I had so far were when I created an infinite loop with with_prototype pushes that eventually reach the threshhold but can sometimes take a long time, and I work with syntax definitions a lot.

deathaxe commented 7 years ago

I use a project with a constant number of test files for syntax development. Many changes to a syntax-file don't result in new symbols. Therefore the memory usage of the symbol index should be the same after re-indexing. This is exactly, what you can see when just saving a syntax-file several times. Sublime Text creates a new process for indexing and the main process's memory usage increases by about 6-8MB from 60MB to about 68MB. After a while the indexing process exits and everything is fine.

After previewing tenth of test files (always one file open at a time) the memory usage increases to 80MB. All previewed files use the same syntax. All files are included in the open project and therefore should have been indexed already. I would expect memory usage to decrease to about 60MB if all files are closed again, but ok - maybe Sublime Text holds some information in RAM now which it loaded while opening the files for the first time - even though 20MB seems quite a lot as all files together have a size of 4MB.

But after some time of working Sublime Text uses 160...300MB of RAM with the same project. No extra files loaded - nothing. The only files being open and changed, is the *.sublime-syntax and one test file to check the result of specific changes to the syntax-file.

If I close Sublime Text and reopen the same project, memory usage is 60M again.

I am not sure if this problem is related to syntax file editing only. It also might be a more generous memory leak issue or something like that. I have the task manager (Win10x64) open, while writing this text using Sublime Text. At the moment the mentioned syntax project is open and the only file being changed is this plain text file. Memory usage of sublime text seems to grow by 1MB with each 5th word I write. Sublime Text uses 102MB at the moment. Just one idea - may the increasing memory usage being caused by the Undo-Feature? But from last sentence to know 7MB more RAM usage? Really heavy!!

FichteFoll commented 7 years ago

I can confirm that memory usage increases when working with ST for a longer period of time. That makes sense in terms of saving the undo history, but I never tested to what extent. I usually restart it when it reaches 300MB after a day or so, however I never put syntax definitions in the equation since this is what I've been working on lately for the most time.

evandrocoan commented 7 years ago

Continuing this on:

  1. https://github.com/SublimeTextIssues/Core/issues/1503 Crash while hovering a File Name on the Tab Bar
  2. $24705 Debug symbols for Sublime Text to figure out from where crash is coming

Due this do not look to be presenting itself any more.

FichteFoll commented 7 years ago

Please don't render forum thread links in the same way as issue links (in the #\d+ format); it's confusing.