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 No JSON object could be decoded; failed to add counter 'tot_0': c0000bb9... #53

Closed mc-aze closed 4 years ago

mc-aze commented 4 years ago

After fresh install of Sublime 3 v3211 and package TabNine 2.5.1, error: Started TabNine v2.5.1 Failed to communicate with TabNine subprocess: No JSON could be decoded

if i run Sublime Text 3\Packages\TabNine\binaries\2.5.1\x86_64-pc-windows-gnu\TabNine.exe i get

failed to add counter 'tot_0': c0000bb9... failed to add counter 'tot_1': c0000bb9... failed to add counter '0_0': c0000bb9... failed to add counter '0_1': c0000bb9... failed to add counter '1_0': c0000bb9... failed to add counter '1_1': c0000bb9... failed to add counter '2_0': c0000bb9... failed to add counter '2_1': c0000bb9... failed to add counter '3_0': c0000bb9... failed to add counter '3_1': c0000bb9... failed to add counter '4_0': c0000bb9... failed to add counter '4_1': c0000bb9... failed to add counter '5_0': c0000bb9... failed to add counter '5_1': c0000bb9... failed to add counter '6_0': c0000bb9... failed to add counter '6_1': c0000bb9... failed to add counter '7_0': c0000bb9... failed to add counter '7_1': c0000bb9... failed to add counter 'net0_out': c0000bb9... failed to add counter 'net1_out': c0000bb9...

this issue is similar to: https://github.com/codota/tabnine-sublime/issues/52#issue-584337388 from that issue i tried:

  1. latest tabnine binary but i get the same error

  2. correctly returns a json containing 2.5.1 as the version tabnine

  3. running cmd as admin but the error persist

  4. correctly shows two process of TabNine.exe

  5. binary 2.3.2 doesnt show the error

  6. binary 2.3.7 shows the error

  7. chml into tabnine.exe version 2.3.7 shows the same error tabnine_chml

  8. I have UAC turned off completely since the beginning and i have admin privileges

  9. Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz, 2601 Mhz, 4 cores (2 logical cores per physical)

  10. TabNine.exe --inner doesnt show the error

  11. lodctr /r didnt fix the error, lodctr /q shows everything enabled

  12. restart windows doesnt fix

  13. config web browser window opens most of the time. Sometimes conection gets rejected. (ERR_CONNECTION_REFUSED using chrome)

  14. bitdefender doesnt show anything wrong

https://docs.microsoft.com/en-us/windows/win32/sysmon/counters-add shows the error code

amircodota commented 4 years ago

Thanks you for the detailed report, @mc-aze

Error c0000bb9 means PDH_CSTATUS_NO_COUNTER, so it fails to find the relevant counter.

Can you open perfmon, and see if you can add the following counter

Processor/% Processor Time/_Total

This is one of the counters that it tries to check, so maybe perfmon will give us a clue into what's going on.

mc-aze commented 4 years ago

image

did i do it right?

Seems like i successfully added the counter. Second time i try adding the same counter i get the warning in the screen that says i already have that counter (spanish).

i tried running tabnine.exe v2.5.1 again but keeps showing the same error

amircodota commented 4 years ago

@mc-aze I suspect it is related to the fact your perf counters names are in spanish. We do use PdhLookupPerfNameByIndexW to translate it to the correct name, but I suspect something there might go wrong.

Do you thing it would be ok if I sent you a private build with some debug prints?

mc-aze commented 4 years ago

yes, im happy to help

amircodota commented 4 years ago

@mc-aze

Can you paste what you have in your registry under HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter?

009 is for english. Do you have another entry other then 009? Can you paste its value too?

mc-aze commented 4 years ago

image

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counter 009.txt

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\CurrentLanguage\Counter currentlanguage.txt

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\00A\Counter 00A.txt

amircodota commented 4 years ago

Very strange, 009 key should always be in english to my knowledge. On your machine it is in spanish, and therefore, we fail to translate The english name to the localized name.

Is this a spanish version of windows 10?

Invstigating...

amircodota commented 4 years ago

@mc-aze

Here is a private test build.

Can you download it and run from command line? Paste back what is the output?

mc-aze commented 4 years ago

im sorry, it was in english 009_.txt

this is the output of the private test build. image

amircodota commented 4 years ago

So it succeeds in translating Processor but fails to translate % Processor Time.

I've created a workaround - can you test?

Download the binary from here. When you run it, you should see no errors. If you open Task manager, you should see only one TabNine.exe process running, instead of two.

mc-aze commented 4 years ago

image

you are right

amircodota commented 4 years ago

@mc-aze

Thank you for your help.

This fix will be released in the next tabnine release - within a few days most likely.

Note that this fix means that tabnine will work, but it runs without its watchdog, so monitoring memory and cpu will not work.

I'll let you know when this fix is available.

amircodota commented 4 years ago

Just released TabNine 2.6.0, that fixes this issue.

@mc-aze can you verify?

mc-aze commented 4 years ago

it works now.

do you need me to check anything?

image

thanks

amircodota commented 4 years ago

cool, glad to hear it works. No need to test anything else.