wbond/package_control

Installed packages cleared on restart

Closed this issue · 4 comments

The installed_packages in the Package Control.sublime-settings are getting cleared whenever I restart Sublime Text 3. Only the recently installed packages remain, but all the older packages are getting removed from the list. All packages are still functioning correctly and are displayed in Package Control: List Packages.

I followed Troubleshooting > Purging and Reinstalling and reinstalled manually using Package Control.sublime-package which seemingly fixed the problem. However once Package Control got updated to version 4.0.x, the problem reappeared.

I backup my Packages\User directory and sync it across devices and worry, that this will prevent packages from installing when I move to a new device with a fresh Sublime Text install.

As the recently installed packages remain in the installed_packages, I wonder if there was some change in Package Control 4.0.x, which makes the recently installed packages behave differently than the packages installed before the update?

If that's by design, how can I instruct Package Control to freshen the older packages, so that they remain in the list?

Versions
Sublime Text 3.2.2 build 3211
Package Control 4.0.3
Settings before restart
{
	"bootstrapped": true,
	"debug": true,
	"in_process_packages":
	[
	],
	"installed_packages":
	[
		"A File Icon",
		"AdvancedNewFile",
		"ApacheConf",
		"ApplySyntax",
		"AutoBackups",
		"AutoHotkey",
		"Better CoffeeScript",
		"Bracketeer",
		"BracketHighlighter",
		"Case Conversion",
		"Clickable URLs",
		"ColorHelper",
		"Dictionaries",
		"DocBlockr",
		"DotENV",
		"Emmet",
		"File History",
		"FindKeyConflicts",
		"Inno Setup",
		"Laravel Blade Highlighter",
		"LaTeXTools",
		"MarkdownEditing",
		"OverrideAudit",
		"Package Control",
		"PackageResourceViewer",
		"PHP Companion",
		"PowerShell",
		"Predawn",
		"RawLineEdit",
		"REG",
		"SCSS",
		"SideBarEnhancements",
		"Terminal",
		"VBScript",
		"WordingStatus"
	]
}
Settings after restart
{
	"bootstrapped": true,
	"debug": true,
	"in_process_packages":
	[
	],
	"installed_packages":
	[
		"ApplySyntax",
		"RawLineEdit"
	]
}
Debug log (redacted)
DPI mode: per-monitor v2
startup, version: 3211 windows x64 channel: stable
executable: /C/Program Files/Sublime Text 3/sublime_text.exe
working dir: /C/Program Files/Sublime Text 3
packages path: /C/Users/.../AppData/Roaming/Sublime Text 3/Packages
state path: /C/Users/.../AppData/Roaming/Sublime Text 3/Local
zip path: /C/Program Files/Sublime Text 3/Packages
zip path: /C/Users/.../AppData/Roaming/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.122669
startup time: 0.163669
first paint time: 0.163669
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
...
plugins loaded
...
Package Control: Download Debug
  URL: https://packagecontrol.io/submit?sublime_version=3211&operation=install&sublime_platform=windows&package=Package+Control&package_control_version=4.0.3&version=4.0.3
  Timeout: 30
  Resolved IP: 50.116.34.243
reloading /C/Users/.../AppData/Roaming/Sublime Text 3/Packages/User/Package Control.sublime-settings
...
reloading settings Packages/User/Package Control.sublime-settings
Package Control: WinINet Debug Proxy
  proxy: 
  proxy bypass: 
  proxy username: 
  proxy password: 
Package Control: WinINet HTTPS Debug General
  Server SSL Certificate:
    subject: packagecontrol.io
    issuer: US, DigiCert Inc, www.digicert.com, RapidSSL TLS RSA CA G1
    common name: packagecontrol.io
    issue date: Fri, 22 Dec 2023 01:00:00 GMT
    expire date: Mon, 23 Dec 2024 00:59:59 GMT
Package Control: WinINet HTTPS Debug Write
  GET /submit?sublime_version=3211&operation=install&sublime_platform=windows&package=Package+Control&package_control_version=4.0.3&version=4.0.3 HTTP/1.1
  User-Agent: Package Control v4.0.3
  Host: packagecontrol.io
  Connection: Keep-Alive
  Cache-Control: no-cache
  Accept-Encoding: bzip2,gzip,deflate
Package Control: WinINet HTTPS Debug Read
  HTTP/1.1 200 OK
  Server: nginx
  Date: Tue, 27 Feb 2024 06:48:01 GMT
  Content-Type: application/json
  Transfer-Encoding: chunked
  Connection: keep-alive
  Vary: Accept-Encoding
  X-App-Version: 1.7.0
  Strict-Transport-Security: max-age=15552000
  Content-Encoding: gzip
Package Control: Prevented Package Control from removing itself.
Package Control: Fetching list of available packages and libraries
  Platform: windows-x64
  Sublime Text Version: 3211
  Package Control Version: 4.0.3
Package Control: Download Debug
  URL: https://packagecontrol.github.io/channel/channel_v4.json
  Timeout: 30
  Resolved IP: 185.199.108.153
Package Control: WinINet Debug Proxy
  proxy: 
  proxy bypass: 
  proxy username: 
  proxy password: 
Package Control: WinINet HTTPS Debug General
  Server SSL Certificate:
    subject: US, California, San Francisco, "GitHub, Inc.", *.github.io
    issuer: US, DigiCert Inc, DigiCert TLS RSA SHA256 2020 CA1
    common name: *.github.io
    issue date: Tue, 21 Feb 2023 01:00:00 GMT
    expire date: Thu, 21 Mar 2024 00:59:59 GMT
Package Control: WinINet HTTPS Debug Write
  GET /channel/channel_v4.json HTTP/1.1
  User-Agent: Package Control v4.0.3
  Host: packagecontrol.github.io
  Connection: Keep-Alive
  Cache-Control: no-cache
  Accept-Encoding: bzip2,gzip,deflate
  If-Modified-Since: Tue, 27 Feb 2024 01:02:13 GMT
  If-None-Match: W/"65dd3495-d445"
Package Control: WinINet HTTPS Debug Read
  HTTP/1.1 304 Not Modified
  Connection: keep-alive
  Date: Tue, 27 Feb 2024 06:48:02 GMT
  Via: 1.1 varnish
  Cache-Control: max-age=600
  ETag: W/"65dd3495-d445"
  Expires: Tue, 27 Feb 2024 01:12:32 GMT
  Age: 26
  X-Served-By: cache-sof1510029-SOF
  X-Cache: HIT
  X-Cache-Hits: 2
  X-Timer: S1709016482.252617,VS0,VE1
  Vary: Accept-Encoding
  X-Fastly-Request-ID: e6f852a47c42511ab70049e28437c33fc60eb8fa
Package Control: Using cached content for https://packagecontrol.github.io/channel/channel_v4.json from \\?\C:\Users\...\AppData\Local\Sublime Text 3\Cache\Package Control\http_cache\af3c96c0f3419e576449bf3a3fe3a8ac
Package Control: Download Debug
  URL: https://packagecontrol.io/channel_v3.json
  Timeout: 30
  Resolved IP: 50.116.34.243
Package Control: WinINet HTTPS Debug General
  Re-using connection to packagecontrol.io on port 443 for request #1
Package Control: WinINet Debug Proxy
  proxy: 
  proxy bypass: 
  proxy username: 
  proxy password: 
Package Control: WinINet HTTPS Debug Write
  GET /channel_v3.json HTTP/1.1
  User-Agent: Package Control v4.0.3
  Host: packagecontrol.io
  Connection: Keep-Alive
  Cache-Control: no-cache
  Accept-Encoding: bzip2,gzip,deflate
  If-Modified-Since: Tue, 27 Feb 2024 06:30:03 GMT
  If-None-Match: "65dd816b-64cd0"
Package Control: WinINet HTTPS Debug Read
  HTTP/1.1 200 OK
  Server: nginx
  Date: Tue, 27 Feb 2024 06:48:02 GMT
  Content-Type: application/json
  Content-Length: 412860
  Last-Modified: Tue, 27 Feb 2024 06:40:03 GMT
  Connection: keep-alive
  ETag: "65dd83c3-64cbc"
  Content-Encoding: bzip2
  Vary: Accept-Encoding
  Strict-Transport-Security: max-age=15552000
  Accept-Ranges: bytes
Package Control: Caching https://packagecontrol.io/channel_v3.json in \\?\C:\Users\...\AppData\Local\Sublime Text 3\Cache\Package Control\http_cache\01524fae79697630d0454ba3fabd9414
Package Control: Fixed URL from https://raw.github.com/darinmorrison/sublime-packages/master/packages.json to https://raw.githubusercontent.com/darinmorrison/sublime-packages/master/packages.json
Package Control: Fixed URL from https://raw.github.com/darinmorrison/sublime-packages/master/packages.json to https://raw.githubusercontent.com/darinmorrison/sublime-packages/master/packages.json
Package Control: Skipping automatic upgrade, last run at 2024-02-27 07:33:12, next run at 2024-02-27 15:33:12 or after
Package Control: WinINet HTTPS Debug General
  Closing connection to packagecontrol.github.io on port 443 after 1 request
Package Control: WinINet HTTPS Debug General
  Closing connection to packagecontrol.io on port 443 after 2 requests

Package Control 4.0.0 (and some prior beta builds) used to clean up installed_packages, if they were no longer available in order to avoid repetitive installation attempts at each start.

This used to cause the list to be cleared in case firewall blocked network connections.

This functionality has therefore been removed in 4.0.1+ (see: 4dcd18a)

I haven't been able to reproduce any such effect since then - and I can't with provided settings.

With only PC 4.0.3 installed in a new setup I can paste your "Settings before restart" and PC will correctly install all those package upon next start with installed_packages keeping untouched.

The log message Package Control: Prevented Package Control from removing itself. does however not fit into the picture as it indicates "Package Control" not being within "installed_packages" when it initially loads - but it is according to your "Settings before restart". I also don't see this message.

I tried on Windows 11 with ST 3143, 3211 and 4173.

Please make sure not to have only Package Control.sublime-package being present, not an unpacked "Packages/Package Control" with probably out-dated version nor a Package.Control.sublime-package (with period in the middle), which would be the case when manually downloading from Github releases.

Thanks for the explanation. Particularly your mention of Package Control: Prevented Package Control from removing itself. being suspicious made me look for a misconfiguration, and so I noticed an automatic backup created by the sync software .../Packages/.stversions/User/Package Control.sublime-settings with the following diff:

diff --git .stversions/User/Package Control.sublime-settings User/Package Control.sublime-settings
index 15101cd..b92cca1 100644
--- .stversions/User/Package Control.sublime-settings
+++ User/Package Control.sublime-settings
@@ -10,2 +10,3 @@
                "ApacheConf",
+               "ApplySyntax",
                "AutoBackups",
@@ -34,2 +35,3 @@
                "Predawn",
+               "RawLineEdit",
                "REG",

The backup was missing exactly the packages which remained in User/Package Control.sublime-settings after restart - all packages present in both files were cleared. After deleting the backup, the problem no longer occurs, and installed_packages remain untouched after the restart.

So, this was a user error - thank you for your help!

I am not sure about closing the issue yet, because after all the duplicated settings did not cause problems on 3.x, but only after the update to 4.x. Perhaps you will want to look further into this.

The way how batched package operations are performed has changed. Settings files are touched a lot less in order to reduce risk of race conditions etc.

If a 3rd-party software manipulates related files in unexpected and undefined ways, there's little Package Control can do to prevent things running out of control.

That's understandable. I hope though our discussion will help if someone experiences similar weirdness in the future.

It was surprising that Package Control would clear the installed_packages referenced in both files, but if you do not plan to look further into it that's perfectly fine. On the other hand, logging debug info about the read configuration files would be extremely helpful here, if that's something Package Control could do.

Anyway, thanks again @deathaxe! 😊