codota / tabnine-sublime

Tabnine Autocomplete AI: JavaScript, Python, TypeScript, PHP, C/C++, HTML/CSS, Go, Java, Ruby, C#, Rust, SQL, Bash, Kotlin, Julia, Lua, OCaml, Perl, Haskell, React
https://www.tabnine.com/install/sublime
MIT License
194 stars 36 forks source link

v2.5.1 Error with sublime 3 3211 #52

Closed martinbaranek closed 4 years ago

martinbaranek commented 4 years ago

After fresh install of Sublime 3 v3211 and package TabNine 2.5.1, i got error: Started TabNine v2.5.1 Failed to communicate with TabNine subprocess: No JSON could be decoded (i forgot to save the error). and this goes over and over. Tried to manually clone repo with 2.5.1, same error. Issue fixed with installing older version - TabNine v2.2.2 and denying write access to binaries (to stop auto-update). 2.2.2 seems to be working, no error in sublime console.

amircodota commented 4 years ago

Thank you for reporting this.

Which os are you using?

martinbaranek commented 4 years ago

Win 10 1903 Ultimate. Python 3.7 installed only (without Anaconda)

amircodota commented 4 years ago

It would be great if you can download the latest tabnine binary here. You can download it to any folder you want.

Run it on the command line. If it works correctly it should just sit waiting for user input.

Paste this as its input

{"request":{"Autocomplete":{"before":"tabnine::version","after":"","filename":"a.js","region_includes_beginning":true,"region_includes_end":true,"max_num_results":5}},"version":"2.0.2"}

If it works correctly, it should return a json containing 2.5.1 as the version.

It it emits an error at any point, paste it here, and we'll take it from there.

Thanks a lot!

martinbaranek commented 4 years ago

I've tried to run it in powershell (admin mode and non-admin mode) and instantly after i ran ./TabNine.exe it started returning: PdhCollectQueryData error: 800007d5 0x13ba1c0 repeatedly.

amircodota commented 4 years ago

Just to make sure, can you run it in the regular windows command line and not in powershell?

It is more similar to how it is run from an editor

Thanks

martinbaranek commented 4 years ago

image Here you go.

amircodota commented 4 years ago

One more thing - Can you close all editors that have a tabnine plugin, then run again from the command line, and see how many tabnine processes you see? There should be two

Thanks

martinbaranek commented 4 years ago

Yes, works. After launching the .exe, two TabNine.exe show up in task manager.

amircodota commented 4 years ago

But the error persists, right?

martinbaranek commented 4 years ago

Yes, still the same error. Does not matter whether cmd/powershell.

amircodota commented 4 years ago

Thank you for your input. Investigating this error.

Could this be a permissions issue? Is your user limited in some way that you are aware of?

martinbaranek commented 4 years ago

Not really, the cmd i've sent was run under admin privileges. Running just basic windows defender AV, and 2.2.2 version works just fine.

amircodota commented 4 years ago

Yes, the code that uses the PdhCollectQueryData was added in 2.3.

Can you run the windows command line "as administrator" and see if it works?

martinbaranek commented 4 years ago

Is there any "intermediate" version (like 2.5.0) binary, so i could check when the bug appears? (I'm git beginner, I've found just the 2.2.2)

martinbaranek commented 4 years ago

Already done, does not work. (Check the image i've sent before, it's Admin: command prompt)

amircodota commented 4 years ago

@martinbaranek I'm pretty sure it will reproduce with 2.3.2.

Can you try running the windows command line "as administrator" and see if it fixes the issue?

martinbaranek commented 4 years ago

Oh, nevermind, the 2.3.2 works. image

amircodota commented 4 years ago

what about 2.3.7?

martinbaranek commented 4 years ago

2.3.7 throws the same error as 2.5.1. So it's definitely between 2.3.2 and 2.3.7

amircodota commented 4 years ago

I'm guessing TabNine.exe has a lower integrity level because it was downloaded, and so does not inherit the administrator priveleges.

Can you try using a tool like chml to check the TabNine.exe integrity level and change it?

martinbaranek commented 4 years ago

image

amircodota commented 4 years ago

Can you temporarily lower UAC and see if it fixes the issue?

martinbaranek commented 4 years ago

I have UAC turned off completely since the beginning.

amircodota commented 4 years ago

Oh, that changes everything :-)

Can you open perfmon, and try to monitor %CPU for the TabNine process? (I can send moredetailed instructions if needed)

martinbaranek commented 4 years ago

On i5-7200u (2 cores, 4 threads) 2.5.1 exe: Error, 15% CPU (constant load, varies between 10-20%, did not stop after 2 minutes)

amircodota commented 4 years ago

OK, Thank you.

I'll try to reproduce it on my own windows machine with all the data you gave me. Hope I can fix it soon, I'll keep you updated

martinbaranek commented 4 years ago

Great! If you need any testing, I'm available most of the time.

amircodota commented 4 years ago

Great!

Thanks a lot for all your help and responsiveness.

One last question - are you an administrator of the machine you are running on?

martinbaranek commented 4 years ago

I am not logged in as the "hidden windows superadmin", but i have admin privileges, and ran all the commands from admin command prompt (cmd -> run as admin)

amircodota commented 4 years ago

Sorry, one more thing.

Can you run TabNine --inner and see if this way it works?

martinbaranek commented 4 years ago

Yes, it works on 2.5.1! No error, returns {"old_prefix":"","results":[{"new_prefix":"2.5.1","old_suffix":"","new_suffix":""}],"user_message":[],"docs":[]}

amircodota commented 4 years ago

I'll explain what's going on, and maybe you can figure out what's going on on your machine.

When you run TabNine, it is basically a monitor process. It runs TabNine --inner as a child process, and monitors it for CPU, using performance counters.

I tested it on my windows 10 machine, as an admin user and a regular user, with UAC enabled or disabled. On my machine it always seem to work.

On your machine, trying to collect performance counter returns PDH_NO_DATA (0x800007D5). According to the docs, this might happen when running without an elevated token, but you have UAC disabled and you are an admin, so that does not seem to be the case.

Any idea what's different between our machines? Maybe you have some security software that recognizes this is a downloaded binary and limits its access or something like that?

martinbaranek commented 4 years ago

Ah, I have just found out - I am sorry for misleading info - i have disabled notifications about UAC, but not UAC itself. Maybe is that a difference? image image

amircodota commented 4 years ago

To my knowledge, that is how you disable UAC. I know the wording is "disable notifications" but I think it actually means "Do not block when...".

amircodota commented 4 years ago

Any other security software there? Antivirus? something else?

martinbaranek commented 4 years ago

No, only Windows defender. I treid to disable it completely, did not help. image There was a security warning on the file, but i checked it, the security disappeared, but still not working.

amircodota commented 4 years ago

I can start sending you binaries disabling some code, to check exactly which line of code causes the error. It will require probably some back and forth several times, to nail the exact line of code. Will that work for you?

martinbaranek commented 4 years ago

OK. I've maybe found the problem, and you're probably not in fault in here: image I have never seen this before. I will do reboot (since I am so stupid i haven't done it before i posted it here :( ) and will give you results. Maybe windows something freaked up in recent update.

amircodota commented 4 years ago

maybe this will help?

martinbaranek commented 4 years ago

maybe this will help?

On second attempt, restoring the values doing that tutorial fixed problems in performance monitor and also fixed running TabNine (2.5.1 now does not throw errors and returns nice JSON).

I am really sorry that my crappy windows took so much of your time. I don't know, what caused it. I will try to reinstall it in Sublime and will close this thread if it works. THanks for your help!

amircodota commented 4 years ago

Glad to hear!

Do not worry about it - I'm pretty sure you are not the only one with this issue. On my end, I'll try to reproduce, and see if I can recognize the situation in code, and make sure TabNine functions even in such a case.

Thanks for all your feedback and troubleshooting

martinbaranek commented 4 years ago

Everything works, TabNine auto updated to 2.5.1, config web browser window successfuly opens.

So it was the bad pointers so system wasnt able to read memory/CPU data. cmd lodctr /r fixed it. Thanks again for everything and I am glad I could help you a little bit.