Not able to run project in LAN after update

I’m using python 3.9.10 build with Win10 in two different environments. Normally I’m connected to a public internet. In my office, internet access is limited by proxy.

Recently I installed ‘requests’ package. With public internet, everything works fine.

But since then, I’m not able to run any program in the office normally, not even those which do not access internet and which were working normally until then. After starting python, there is a big time-out (at least one minute) which makes the program practically useless.

Also the ‘state’ command does not work properly. There is a long time-out again and then there is an error message “Something went wrong” & “Failed to check for update”.

If the computer is offline (not connected to LAN), there is no delay and the ‘state’ command behaves as expected. I don’t need to run programs which require internet in my office, but I need to be connected to LAN, so disconnecting is not a solution for me.

I don’t know if the change of behavior was caused by the installation of ‘requests’ package (even if not used), or by the update of the state tool, but as I wrote, this problem did not occur before.

How can I get rid of the delay?

Thanks for help.

It sounds like your system might not be configured to give proxy access to the State Tool when you are at the office. There’s a troubleshooting section in our online manuals for setting up the required environment variables, here: Network Configurations :: ActiveState Platform Documentation

Well, yes, this might be the cause of the problem. But it does not explain why the problem appeared with the update. I am not aware of any network settings change at that time.

And as I wrote, I do NOT actually need to access the internet, so I thought I could save the effort setting up the proxy variables…

Thanks anyway :slight_smile:

Do you remember which version of the State Tool you were on before the update? Your update of the State Tool brought you to 0.38.1, yes?

For your python delays, which version of the requests module are you using? That might have a bearing.

Does the delay (and the error message) go away if the laptop is in airplane mode (with no internet at all)?

Hi @kuzja. I’m one of the State Tool developers. For ease of debugging I’d like to focus on your “state” command not working properly, as I suspect this is a symptom of the same cause.

Could you run your state command again, but with the VERBOSE=true environment variable set? That should produce debugging output, could you share that with us in this topic? Or if you’re concerned with sharing this data in public feel free to PM me.

If you’re running from cmd, this is what you would be running:

set VERBOSE=true
state <your command>

Unfortunately not. But most likely it was version that was current on 25 Nov 2022.

Your update of the State Tool brought you to 0.38.1, yes?

With installation of the requests package, the State Tool was updated to 0.37.1. It was when the problem appeared. Recently I updated to 0.38.1, but the problem remains.

For your python delays, which version of the requests module are you using? That might have a bearing.

Version 2.28.2.
NB: the delay is there even if the python program does not import requests.

Does the delay (and the error message) go away if the laptop is in airplane mode (with no internet at all)?

Yes, it does.

I’m not sure why but the state command does not always yield the “Something went wrong” message. Sometimes it just waits and then, after the delay, it show the help screen as usual. So in this case the behaviour is similar to that of python itself.

I was not able to catch the error message recently, but nevertheless, I enclose the verbose listing. You can see the delays there (“Could not sync authenticated state”).


(PID 5632) [DBG 12:36:07.972 defaults.go:102] Args: [state]
(PID 5632) [DBG 12:36:07.986 listeners.go:18] Adding listener for config key: report.errors
(PID 5632) [DBG 12:36:07.989 locale.go:42] Init
(PID 5632) [DBG 12:36:08.000 instance.go:123] Setting config: Locale
(PID 5632) [DBG 12:36:08.029 rollbar.go:32] Sending Rollbar reports? false
(PID 5632) [DBG 12:36:08.029 subshell.go:206] Detected SHELL: cmd
(PID 5632) [DBG 12:36:08.029 output.go:53] Requested outputer for
(PID 5632) [DBG 12:36:08.029 output.go:58] Using Plain outputer
(PID 5632) [DBG 12:36:08.029 main.go:140] ConfigPath: C:\Users\stolin\AppData\Roaming\activestate\cli-release
(PID 5632) [DBG 12:36:08.029 main.go:141] CachePath: C:\Users\stolin\AppData\Local\activestate\cache
(PID 5632) [DBG 12:36:08.029 client.go:18] Initializing ipc client with socket: C:\Users\stolin\AppData\Local\Temp\state-ipc\state-release.sock
(PID 5632) [DBG 12:36:08.033 svcctl.go:111] Located state-svc at :60978
(PID 5632) [DBG 12:36:08.034 instance.go:123] Setting config: projects
(PID 5632) [DBG 12:36:08.039 auth.go:121] Authenticating with stored API token
(PID 5632) [DBG 12:36:08.050 auth.go:274] AuthenticateWithToken
(PID 5632) [DBG 12:36:08.050 auth.go:198] AuthenticateWithModel
(PID 5632) [DBG 12:36:08.050 instance.go:123] Setting config: projects
(PID 5632) [WRN 12:36:38.061 main.go:203] Could not sync authenticated state: Failed to authenticate with API token
(PID 5632) [DBG 12:36:38.065 subshell.go:206] Detected SHELL: cmd
(PID 5632) [DBG 12:36:38.065 subshell.go:117] Using binary: C:\Windows\System32\cmd.exe
(PID 5632) [DBG 12:36:38.071 instance.go:123] Setting config: projects
(PID 5632) [DBG 12:36:38.086 secrets.go:61] secrets-api scheme=https base_path=/api/secrets/v1
(PID 5632) [DBG 12:36:38.092 instance.go:123] Setting config: projects
(PID 5632) [DBG 12:36:38.102 secrets.go:61] secrets-api scheme=https base_path=/api/secrets/v1
(PID 5632) [DBG 12:36:38.102 autoupdate.go:177] Not running auto updates because we just freshly installed
(PID 5632) [DBG 12:36:38.112 auth.go:121] Authenticating with stored API token
(PID 5632) [DBG 12:36:38.112 auth.go:274] AuthenticateWithToken
(PID 5632) [DBG 12:36:38.112 auth.go:198] AuthenticateWithModel
(PID 5632) [WRN 12:37:08.117 auth.go:72] Could not sync authenticated state: Failed to authenticate with API token
(PID 5632) [DBG 12:37:08.117 instance.go:123] Setting config: auto_update_lastcheck
(PID 5632) [DBG 12:37:08.128 svc.go:137] Checking for deprecation
(PID 5632) [DBG 12:37:08.133 cmdcall.go:50] cmdcall
(PID 5632) [DBG 12:37:08.138 state.go:56] Execute
(PID 5632) [DBG 12:37:08.138 table.go:119] Table column widths: [15 80], total: 95
state [flags]
state [command]

Available Commands:

Environment Setup:
checkout Checkout the given project and setup its runtime
switch Switch to a branch, commit, or tag

Environment Usage:
activate Activate a project
exec Intercept and run a script via a project runtime environment
shell Starts a shell/prompt in a virtual environment for the given project runtime
use Use the given project runtime

Project Usage:
projects List your projects
run Run your project scripts

Package Management:
import Import packages from a list of dependencies
info Display information for the specified package
install Add a new package to your project
packages List packages used in your project
uninstall Remove a package from your project

auth Authenticate against the ActiveState Platform

Version Control:
fork Fork an existing ActiveState Platform project
history View history of the active or given project
pull Pull in the latest version of your project from the ActiveState Platform
push Push your latest changes to the platform
reset Reset local checkout to a particular commit
revert Revert a commit

scripts Show project scripts

clean Clean caches, configuration files, or completely remove the state tool
config Manage the State Tool configuration
export Print information based on the provided subcommand
learn Read the State Tool cheat sheet to learn about common commands
update Updates the State Tool to the latest available version

-h, --help Help for this command
-l, --locale string Set the localisation
–mono Force monochrome text output
-n, --non-interactive Run the State Tool without any prompts
-o, --output string Set the output method, possible values: plain, simple, json, editor
-v, --verbose Verbose output
–version Show the version of our state executable

Use “state [command] --help” for more information about a command.

To access the list of full commands, including unstable features still in beta, run:

“state config set optin.unstable true”
(PID 5632) [DBG 12:37:08.138 cmdcall.go:50] cmdcall
(PID 5632) [WRN 12:37:09.148 main.go:209] Failed waiting for events: timed out waiting for events

@kuzja thanks, it does indeed seem like authentication may be causing slowdowns, seems it’s trying to authenticate which is oddly not failing immediately due to you not having an internet connection. Note it only does this because you appear to have authenticated before though.

Since you aren’t using an internet connection there’s also no point in being authenticated, so I wonder if simply logging out would resolve your problem. Try running state auth logout, and if that does not work, try cleaning your state tool config settings: state clean config.

Sadly this can’t be the same symptom as the one you are having when running python, as we do not do anything with authentication when you run python. In order to diagnose that problem further I’ll need you to run a python command with the ACTIVESTATE_VERBOSE=true environment variable set, which will again give us some debugging information. Please share the results of this.

Note it now seems we are handling two separate issues in this topic, which might get a bit confusing. The first issue being State Tool being slow to respond, and the second one is Python seemingly timing out. Hopefully, the first one is addressed with logging out, if not we may want to split this off into a separate topic so we’re not getting our wires crossed.

To be able to tell if the problem is related to the requests package, I decided to fork my project and to remove requests from the new runtime.

(Un)fortunately, I am not able to reproduce the problem in the same manner after that.

The matter is that when forking, I also renamed the original project from the web interface, and after that I was struggling with the command line to reflect the change - the state tool was always complaining the “old name” project does not exist. (Btw I could not find any advice how to proceed in ActiveState docs, but it is OFT here.)

In the end I succeeded, but I lost track of the exact steps I did. I cleared the cache at one moment, but I don’t know if it helped.

Anyway, running python does not suffer from any delay anymore. At one moment, it seemed to me that the fork with requests has the delay and the other does not, but I’m not able to reproduce it now.

You are right, it helped. Now the state tool does not have the delay.

I agree the results of my test confirm they were two different problems, though with a very similar manifestation. As the “python delay” disappeared (at least for the moment), and the cause of the “state delay” was explained, I believe we can consider this topic closed. However, if you’d like me to do some more tests, I am open for suggestions. :slight_smile:

Thanks everybody for your help!

Great to hear your issue was resolved! I don’t think it’s worth debugging further, I have a handle on what the State Tool issue was, and it sounds like the Python issue was likely unrelated to the State Tool itself. That said if it happens again the debugging steps I gave you should give us some insight, so consider opening a new ticket with the output of the debugging command in that case.