Sublime Forum

Processes are not killed after finished

#1

Running on Ubuntu 20.04 here, Version 3.2.2 build 3211.

Problem : When running a script with Python3 or Latex, the process stays in memory after it’s finished. I have to kill them manually. I discovered this after my computer froze at least twice, and it was caused by python processes from Sublime eating up all RAM and swap. Also, I had problems with matplotlib complaining that all available resources for new windows were taken, after I run some scripts (always closing windows).

Expectation : when a job is finished, the process should be killed, freeing up memory and resources.

Tests : I didn’t test with other languages besides Latex or Python. I tried in Sublime build 3210, and it had the same behavior. I tried to look for in this forum, and I couldn’t find anything similar.

Thanks in advance for any help!

0 Likes

#2

are you using the built in Python build system? After your code runs, do you see [Finished in 0.05 seconds] or something similar at the bottom of the build output pane? Does the same problem occur with a simple Python script like print('testing123')?

0 Likes

#3

Hi! Thanks for your attention.

Uhn, you are right, both Python3 and Latex build systems are customized ones… When I tried to use with Python built in system it shows “[Finished in 0.0s with exit code 127]”, but with my custom Python3 only “>>>” appears.
Where can I find these built in build system configurations, to check what is missing? I only found some files related to them, that can’t be read.

Thank you very much!

0 Likes

#4

The default build systems for things can be found by using View Package File from the command palette; the default Python build is in Python/Python.sublime-build.

Any sublime-build file that doesn’t have a target key in it uses the exec command in order to carry out the build.

When the task launched by exec terminates, it displays the [Finished] text, possibly with an error code if the task failed. However, it does not kill an already running build if you try to run a build again while one is already running.

So indeed if you start another build running before the first one is finished, you will end up with multiple things running in the background. The Tools > Cancel Build or Build: Cancel commands can be used to stop a running build if your intent isn’t to have multiple things running in the background.

Are you using a custom target (say for example "target": "terminus_exec" or such?).

This message is an indication that Python has gone interactive (for example if you had -i in the argument list). Without a custom target, that won’t work. exec displays output, but it does not accept input.

In that case, your build isn’t finishing because Sublime is waiting for python to exit, and python won’t exit because it’s waiting for you to quit it, but you can’t because you can’t provide it the input to do so (though you can still cancel it as above).

2 Likes

#5

Thanks, OdatNurd!
The problem in Python3 was that I copied the build system from some website, and there was a “-i” flag, which I didn’t noticed.
Now it is working! Thanks!
About Latex, I will remove some packages, because I have two build systems with the same name, and try to install them again.

1 Like