Sublime Forum

Package Control: A full-featured package manager

#92

[quote=“sublimator”]Hrmmm, so I don’t think it is a subprocess/hg bug but rather some weird condition comprised of showing the quick_panel from a timeout inside a thread when the Sublime window doesn’t have focus. I guess only Jon would really know what the issue is there.

I got curious after going to bitbucket when in my notifications I saw a commit Guillermoo made to his Hg plugin. He was using windowless subprocess also. I then watched process explorer while alt - tabbing between it and Sublime and noticed Sublime crashing when git was the subprocess. Hrmm…

Anyway, so I found that it crashed fairly consistently at the same point, that being right at the end of PackageInstaller.make_package_list, after the very lastest package which in my group of plugins happens to be git controlled.

Hrmmm. So it seems to happen when switching windows. What if we make Sublime wait until it’s focused? Does it still crash?

[code] if os.name == ‘nt’:
from ctypes import windll
getwh = windll.user32.GetForegroundWindow

        while getwh() != self.window.hwnd():
            time.sleep(0.001)

[/code]

It doesn’t seem to in the 4-5 manual tests I’ve done. These crashes are only effecting us windows (lo|u)sers you say?[/quote]

Thanks for the tip about the quick panel. I found that this simple example shows the crash off.

# coding=utf-8
import sublime
import sublime_plugin
import threading
import time


class InstallPackageCommand(sublime_plugin.WindowCommand):
    def run(self):
        thread = InstallPackageThread(self.window)
        thread.start()


class InstallPackageThread(threading.Thread):
    def __init__(self, window):
        self.window = window
        threading.Thread.__init__(self)

    def run(self):
        time.sleep(3)
        def show_quick_panel():
            self.window.show_quick_panel('foo'], 'bar']], self.on_done)
        sublime.set_timeout(show_quick_panel, 0)
    
    def on_done(self, num):
        print num


sublime.active_window().run_command('install_package')

Basically if a set_timeout of 0 that shows a quick panel is called in a thread and Sublime isn’t the foremost window (on Windows) then it will crash. Changing the timeout to anything larger than 0 fixes the crash. Another interesting thing is that if the sublime window is not focused, the quick panel never shows, but instead fires the on_done callback with -1, like if the user had hit escape.

0 Likes

#93

[quote=“sublimator”]So the crash is NOT happening on linux/osx?

You are getting the -1 cancelling behaviour though?[/quote]

On Linux and OS X I do not get a crash and the quick panel does show even though another window has the focus. I can return focus to the ST2 window and interact with the quick panel.

[quote=“sublimator”]I kind of like having set_timeout not queue up/halt when Sublime is unactive.

It should show the quickpanel though eh and wait for input rather than cancel.[/quote]

Yeah, I would not expect set_timeout to queue up or halt when it is not active. I would expect the timers to run as normal. And I agree, I think the behavior on Linux and OS X seems correct with the quick panel showing and waiting for input.

0 Likes

#94

I just pushed version 1.2.5 out.

Thanks sublimator for all of the help. I ended up testing and getting the 150ms staggering to work well and I am seeing faster performance.

For a short term fix that isn’t too messy I updated all of the sublime.set_timeout() calls to 10ms instead of 0ms. This seems to prevent the crashing issue on Windows that bizoo was having and I think some other crashing issues that Windows users have mentioned when trying to install and upgrade packages.

0 Likes

#95

Just tried this on windows and get long delays when repos are refreshing. Also, it only seems to show about 5 available packages. Any idea what is going on?

0 Likes

#96

It sounds like https URLs are timing out. All of the packages are served over https, except for mine since I host my own packages.json file. It just so happens I have 6 packages available. The rest of the packages are hosted on GitHub and BitBucket, which force use of SSL.

If you look at the console (ctrl+`) you will probably see some errors about downloading URLs. Let me know what you find and I can try to help resolve it.

0 Likes

#97

You are probably right - i am behind a proxy, which has caused issues with other source control programs. Do you know of a system environment variable or some other setting I can change, probably related to proxies, to allow this to go through?

0 Likes

#98

Package Control has two settings, http_proxy and https_proxy. If you set http_proxy and not https_proxy, the http_proxy will be used for https also.

You can see the settings to copy by going to the Preferences > Package Settings > Package Control > Settings - Default menu entry. Copy those two settings to the Preferences > Package Settings > Package Control > Settings - User file and customize there.

0 Likes

#99

I want to add “https://bitbucket.org/wuub/sublimerepl” to Package Control but I want the “default” branch, not the “pexpect” one that run only in linux.
How I could specify the branch in the config ?

Edit:
Didn’t find a way in the api.bitbucket.org documentation to find the last changeset of a branch, so actually it’s the last changeset of the repository that is downloaded, which is not the one I want. :frowning:

0 Likes

#100

[quote=“bizoo”]I want to add “https://bitbucket.org/wuub/sublimerepl” to Package Control but I want the “default” branch, not the “pexpect” one that run only in linux.
How I could specify the branch in the config ?

Edit:
Didn’t find a way in the api.bitbucket.org documentation to find the last changeset of a branch, so actually it’s the last changeset of the repository that is downloaded, which is not the one I want. :frowning:[/quote]

Yeah, it looks like I need to update Package Control to explicitly specify the default branch when grabbing changesets. api.bitbucket.org/1.0/repositor … lt?limit=1

I should be able to do this later today.

0 Likes

#101

Didn’t found the syntax for the branch, I must be blind.
Anyway, I suppose that an entry in the config file to specify the branch is required, I’m not sure that we don’t want default branch everytime.

Thanks.

0 Likes

#102

[quote=“bizoo”]Didn’t found the syntax for the branch, I must be blind.
Anyway, I suppose that an entry in the config file to specify the branch is required, I’m not sure that we don’t want default branch everytime.[/quote]

I think that having Package Control only pull from default when you specify a BitBucket URL is perfectly fine. If you want to use a version in a branch then you can clone the repo, checkout the branch and Package Control will keep it up to date with the remote for you.

0 Likes

#103

Didn’t know you could do that, nice.

Thanks for the update.

0 Likes

#104

Oups (on upgrade command):

startup, version: 2117 windows x64 channel: dev ... Exception in thread Thread-4: Traceback (most recent call last): File ".\threading.py", line 532, in __bootstrap_inner File ".\Package Control.py", line 500, in run File ".\Package Control.py", line 300, in get_packages KeyError: 'changesets'
This is the JSON I receive, no ‘changesets’ records

{ "node": "3bd4e612ff6e", "files": { "type": "added", "file": ".hgignore" }, { "type": "added", "file": "Default (Linux).sublime-keymap" }, { "type": "added", "file": "Default (OSX).sublime-keymap" }, { "type": "added", "file": "Default (Windows).sublime-keymap" }, { "type": "added", "file": "case_conversion.py" } ], "raw_author": "Scott Bessler <scottbessler@gmail.com>", "utctimestamp": "2011-09-15 01:00:39+00:00", "author": "scottbessler", "timestamp": "2011-09-15 03:00:39", "raw_node": "3bd4e612ff6ea1c865772a971fb517cc42f386f1", "parents": ], "branch": "default", "message": "modifying case conversion to work on all selections, and pep8ing it", "revision": 0, "size": -1 }
I changed all:

last_commit'changesets'][0]

by:

last_commit

And apparently it works.

0 Likes

#105

[quote=“bizoo”]Oups (on upgrade command):

startup, version: 2117 windows x64 channel: dev ... Exception in thread Thread-4: Traceback (most recent call last): File ".\threading.py", line 532, in __bootstrap_inner File ".\Package Control.py", line 500, in run File ".\Package Control.py", line 300, in get_packages KeyError: 'changesets'[/quote]

I’ll get a fix out for that today. Thanks for the report.

0 Likes

#106

Is this a package manger bug or sublime bug? When I start sublime and i’m not online I get an error box saying it couldn’t fetch the repository url and then sublime doesn’t load. I have to kill sublime in the task manager and start it again.

0 Likes

#107

I’m not sure what the issue is there. I did just release version 1.2.7 so try to upgrade to that if you can. If you do continue to have problems, please open a ticket at github.com/wbond/sublime_package_control/issues since there is no notification system here on the forum.

0 Likes

#108

As much as I like Package Control it throws a series of errors from time to time on ST2 startup.

The error it throws is:

Package Control: Error downloading repository. HTTP error 503 downloading INSERT URL OF WHATEVER PACKAGE IT'S FAILING TO LOAD

Any suggestions as to what’s going on and how to fix it from freaking out?

0 Likes

#109

[quote=“aple”]As much as I like Package Control it throws a series of errors from time to time on ST2 startup.

The error it throws is:

Package Control: Error downloading repository. HTTP error 503 downloading INSERT URL OF WHATEVER PACKAGE IT'S FAILING TO LOAD

Any suggestions as to what’s going on and how to fix it from freaking out?[/quote]

A 503 error means that the service is temporarily unavailable. The way to work around it is to tell me you are having the problem, at which point I’ll look into enhancing the retry functionality to handle 503s in addition to timeouts. :smile: Is it GitHub that is triggering the 503s? What platform are you running on?

I’ll try to do this later today. Hopefully in the near future I’ll also be rolling out a centralized cache of package info that will help prevent issues like this, but also drastically improve the performance of Package Control.

0 Likes

#110

I’ve been having a similar issue, using OS X Lion 10.7.1 and the latest dev version of ST2. This error pops up on start:

When I do Package Control: Discover, the error pops up again, and if I hit enter on any of the packages, it freezes ST2.

edit: I went in and removed SublimeLinter from Package Control Settings - User (there were two entries – even when I removed one it was still giving the error). Once I removed both of them, and re-installed SublimeLinter using Package Control, it worked fine. I remember the previous time I installed it, I had to enter the Git URL myself. Now I just have this in my User Settings file:

{
	"auto_upgrade_last_run": 1316267222,
	"repositories":
	
		"https://github.com/buymeasoda/soda-theme"
	]
}
0 Likes

#111

[quote=“natebeaty”]I’ve been having a similar issue, using OS X Lion 10.7.1 and the latest dev version of ST2. This error pops up on start:

When I do Package Control: Discover, the error pops up again, and if I hit enter on any of the packages, it freezes ST2.[/quote]

It looks like you have an improper repository URL to your installation, although I could be wrong. I don’t believe Package Control ever uses URLs with .git at the end, which is why I think you may have added one. Please go to Preferences > Package Settings > Package Control > Settings - User. Delete any reference to SublimeLinter from your repositories setting. SublimeLinter is part of the default channel so you shouldn’t need to add . If it was there, after you delete it you should not longer get a 404 (not found) error. You should now be able to install SublimeLinter.

If this is not the case, please open a ticket on GitHub at github.com/wbond/sublime_package_control/issues. Unfortunately this forum isn’t a very good place for bug reports since there is no notification mechanism.

0 Likes