alibaba-cloud-toolkit / cosy

阿里云智能编码插件品牌升级为通义灵码,欢迎查看通义灵码帮助手册,同时也期待你在 IDE 客户端中将插件升级,我在通义灵码等你,一起开启智能编码之旅。
https://tongyi.aliyun.com/lingma
435 stars 28 forks source link

始终无法使用,即使使用离线全量包也不行 #188

Closed fantasyjqc closed 10 months ago

fantasyjqc commented 1 year ago

Describe the bug(描述您遇到的问题)

内网环境无外部网络,即便是kill所有进程、删除.cosy文件夹然后重新安装all in one的全量包,进行代码补全的时候仍然是每次都会进行更新操作,然后失败进入死循环的状态。

To Reproduce(复现步骤)

内网环境无外部网络,即便是kill所有进程、删除.cosy文件夹然后重新安装all in one的全量包,进行代码补全的时候仍然是每次都会进行更新操作,然后失败进入死循环的状态。

Screenshots(截图) 日志如下,这个错误会反复出现,即使kill掉进程,依然会提示这个错误。

2023-06-08 10:07:51,182 [ 56067] INFO - #com.alibabacloud.intellij.cosy.core.BinaryManager - checking cosy updating. 2023-06-08 10:07:51,356 [ 56241] WARN - #com.alibabacloud.intellij.cosy.core.BinaryManager - local binary version is equal to plugin internal version, checking signature 2023-06-08 10:07:52,574 [ 57459] INFO - #com.alibabacloud.intellij.cosy.util.FileUtil - File [.cosy/.DS_Store] exists in zip but not in local file system 2023-06-08 10:07:52,575 [ 57460] INFO - #com.alibabacloud.intellij.cosy.core.BinaryManager - Zip file list is not equal to local files, need to upgrade. 2023-06-08 10:07:52,575 [ 57460] INFO - #com.alibabacloud.intellij.cosy.core.BinaryManager - start to init binary file. 2023-06-08 10:07:53,319 [ 58204] INFO - #com.alibabacloud.intellij.cosy.core.BinaryManager - Check cosy process before initBinary 2023-06-08 10:07:53,319 [ 58204] INFO - #com.alibabacloud.intellij.cosy.core.Cosy - cosy home dir C:\Users\260204\.cosy 2023-06-08 10:07:53,319 [ 58204] INFO - #com.alibabacloud.intellij.cosy.core.Cosy - .info file not exist, wait 100ms and retry 2023-06-08 10:07:53,821 [ 58706] INFO - #com.alibabacloud.intellij.cosy.core.Cosy - Retry for fetching .info for 1 times, 0 times left 2023-06-08 10:07:53,821 [ 58706] INFO - #com.alibabacloud.intellij.cosy.core.BinaryManager - Pid not exist when trying to kill process, skip process killing 2023-06-08 10:07:53,975 [ 58860] SEVERE - #c.i.o.p.Task - unzip error:C:\Users\260204\AppData\Local\Temp\cosy_1686190072672.zip java.lang.RuntimeException: unzip error:C:\Users\260204\AppData\Local\Temp\cosy_1686190072672.zip at com.alibabacloud.intellij.cosy.util.ZipUtil.unZip(ZipUtil.java:84) at com.alibabacloud.intellij.cosy.core.BinaryManager.initCosy(BinaryManager.java:121) at com.alibabacloud.intellij.cosy.core.BinaryManager.checkCosy(BinaryManager.java:82) at com.alibabacloud.intellij.cosy.core.BinaryManager.checkCosy(BinaryManager.java:58) at com.alibabacloud.intellij.cosy.core.Cosy$1.run(Cosy.java:125) at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429) at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:480) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:186) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173) at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.io.FileNotFoundException: C:\Users\260204\.cosy\bin\0.2.14\x86_64_windows\Cosy.exe (另一个程序正在使用此文件,进程无法访问。) at java.base/java.io.FileOutputStream.open0(Native Method) at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293) at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235) at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:2451) at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:2415) at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1042) at com.alibabacloud.intellij.cosy.util.ZipUtil.unZip(ZipUtil.java:79) ... 24 more

cosy的日志如下:

2023-06-08T10:16:52.663+0800 INFO Checking update ... 2023-06-08T10:16:52.672+0800 INFO System platform x86_64_windows 2023-06-08T10:16:52.680+0800 ERROR Cosy update failed: failed to initialize client

System(本地系统)

Contact Info(如愿意请留下联系方式,需求上线后,我们将第一时间联系您)

zxdxjtu commented 1 year ago

看报错是cosy.exe被占用,无法删除重启。再试试杀死cosy进程,删除.cosy目录呢,确认下cosy.exe不存在。然后安装cosy all-in-local包,重启IDEA。

fantasyjqc commented 1 year ago

这个有尝试很多次,并不能解决问题,而且观察发现在idea没启动前cosy是未启动的,打开idea之后,随后cosy会启动,然后就报cosy被占用,这个就很奇怪,明明cosy是idea启动的,而且cosylocal这个进程是始终没有启动的。不知道是不是其他程序对cosy有干扰,但是又看不到其他报错的日志就很迷

zxdxjtu commented 1 year ago

@fantasyjqc 本地有没有装多个IDEA,Android studio,Pycharm之类的?可能其他JetBrains产品上装了别的版本的Cosy,和IDEA上面的all-in-one版本自带的Cosy起冲突了。

starryknight1231 commented 1 year ago

同样的问题 ,安装的cosy all-in-local包 ,给同事安装,然后他能使用T.T,和他唯一的区别就是他没有通过插件市场安装过,cosy 的日志如下: 2023-07-13T08:36:24.227+0800 INFO ===== Starting cosy service ===== 2023-07-13T08:36:24.228+0800 INFO Config Local exclude lang: 2023-07-13T08:36:24.228+0800 INFO Preparing inference environment 2023-07-13T08:36:24.228+0800 INFO Inference environment is ready 2023-07-13T08:36:24.229+0800 INFO Starting local java inference service 2023-07-13T08:36:24.258+0800 INFO Local inference service initialized 2023-07-13T08:36:24.269+0800 INFO Server is ready at: 62674, cost: 41.1819ms 2023-07-13T08:36:24.472+0800 INFO A new client is registered 2023-07-13T08:36:24.485+0800 INFO Initializing server.. 2023-07-13T08:36:24.485+0800 INFO Training models for python processor... 2023-07-13T08:36:24.485+0800 INFO Symbol cache loaded 2023-07-13T08:36:27.513+0800 ERROR Failed to call 2023-07-13T08:37:15.039+0800 INFO 0 python files are indexed 2023-07-13T08:37:15.041+0800 INFO Server initialized, time cost: 50.5546887s 2023-07-13T08:51:24.008+0800 INFO Checking service state

zxdxjtu commented 1 year ago

@shulipeng 可以看下IDEA的日志报错,如果和楼主的一样,只能先试一下杀掉cosy所有进程,删除.cosy目录,确保all-in-local包是最新的(https://toolkit.aliyun.com/idea/cosy-intellij-beta-latest-all-in-one.zip)。 之前碰到的一例Cosy.exe (另一个程序正在使用此文件,进程无法访问。)的报错,貌似是因为公司的安全软件在检测Cosy可执行文件,导致文件被占用,无法打开,不知道会不会是同样的原因