Sublime Forum

A way to debug plugin host crashes

#1

There seems to be no way to figure out what causes the plugin host to crash. There needs to be a way to do that so that we can at least figure out which plugin causes it and disable or fix it.

I get random crashes of the plugin host few times a day (latest dev build) and it’s quite annoying. It seems to be even more crash prone on Windows 10 than on Windows 7.

I guess it might be quite difficult to implement but we could have debug mode where each package runs in it’s own process. That should at least allow identifying which package is causing the crash.

Or some debugging mode where plugin host would log as much info as possible before making any sublime API call.

Ideally it would be impossible to crash the plugin host of course.

1 Like

#2

You should be able to somewhat reliably find the offending package by utilizing a binary search algorithm, i.e. disable half of all packages and see if the problem went away. Continue with the appropriate other half.

1 Like

#3

Not that helpful if crashes happen few times a day only and there might be days when I don’t get crashes. Would take weeks to reliably find the offender.

0 Likes

#4

Unfortunately, as discussed in plugin_host frequently crashes on opening a file with Ctrl+P, there isn’t a way to recover the Python interpreter once it hits an abort state. Thus, I don’t think we’ll ever get to a point where you can’t crash plugin host. I mean, even Chrome has crashes that abort page loads. Also, plenty of packages use Python extensions (which are written in C), it is pretty trivial to crash Python.

Having each package run in its own process would prevent sharing code, which many packages do. Thus we’d be breaking a bunch of existing functionality, so I’m not sure a debug mode like that would really be all that usable.

It may be the case that some functionality could be baked into Package Control to help with binary searches.

Honestly, I would start with more intense packages that do things like code intelligence or interact with other programs on your machine.

1 Like

#5

You brought up Chrome example, where page can crash, but that typically crashes only the tab (browser crashes are rare) and you can reload the tab quickly. Sublime could at least recover gracefully from the crash by restarting the host and loading all packages again.

0 Likes

#6

Can you provide a list of packages you have installed? I may be able to help in identifying likely packages.

My example of Chrome was just to show that a massive project with huge funding and a large team can’t even reliably keep a plugin host from crashing.

0 Likes

#7

@guillermooo and I am working on a “Troubleshooting” package that will support this eventually. I’ve wanted to do it for years now.

2 Likes

#8

That sounds great!

0 Likes

#9

Is it possible to write a crash log at this point with the function stack trace and maybe a bit of history to identify the plugin?

0 Likes

#10

I figured it’s most likely SublimeClang plugin which is not unexpected given that it uses native clang compiler.
I can’t really live without it though…

0 Likes