简体   繁体   English

同时启动多个实例时,VisionProxy.dll上出现Sikuli脚本IO错误

[英]Sikuli Script IO Error on VisionProxy.dll when launching multiple instances simultaneously

I have the following problem on Windows. 我在Windows上遇到以下问题。 I am using SikuliScript in interactive mode which is working fine. 我在交互模式下正常使用SikuliScript。 That's the commandline I use to launch it: 那是我用来启动它的命令行:

"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar "E:\APPS\Sikuli\Runtime\sikuli-script.jar" -i

However if I launch this command at least twice roughly at the same time (either manually or via Scheduled Tasks) I'll get a Java Exception because VisionProxy.dll already exists in my Temp Directory and cannot be overwritten because it's actively in use (by the other command of course): 但是,如果我大约同时(手动或通过计划任务)至少两次启动此命令,则会收到Java异常,因为VisionProxy.dll已存在于我的临时目录中,并且由于正在被积极使用而无法覆盖(通过当然是另一个命令):

java.io.FileNotFoundException: C:\Users\%USERNAME%\AppData\Local\Temp\2\tmplib\VisionProxy.dll (The process cannot access the file because it is being used by another process)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)

The DLL gets put there by Sikuli itself when the library gets loaded so I don't know how to prevent this. 当库被加载时,DLL被Sikuli自己放置在那里,所以我不知道如何防止这种情况。 Has anyone had a similar problem and solved it? 有谁遇到过类似的问题并解决了吗?

Thanks & Regards 感谢和问候

There's no quick and easy fix for this. 没有快速简便的解决方案。

What's happening is that the sikuli-script jar is using a little trick to allow it to be packaged as a single self-contained jar. 发生的事情是sikuli-script jar使用了一些技巧,可以将其包装为一个独立的jar。 The jar file contains all the native libraries that it might need, and when you run it, the code figures out which one you actually need (Windows_x86, maybe), pulls it out of the jar into the temp directory, and then dynamically links it. jar文件包含它可能需要的所有本机库,当您运行它时,代码会找出您实际需要的库(可能是Windows_x86),将其从jar中拉出到temp目录中,然后动态链接它。 Running two in a row as your doing makes the DLL extraction process fail because one process stomps on the others' files. 连续运行两个操作会使DLL提取过程失败,因为一个过程踩在其他文件上。

The only fix for this is changing the code. 唯一的解决方法是更改​​代码。 You'll need to get the source code for Sikuli, find where it's performing the dynamic link trick, and remove that. 您需要获取Sikuli的源代码,找到它在哪里执行动态链接技巧,然后将其删除。 Then you'll need to build it yourself and manually link against the DLL. 然后,您需要自己构建它并手动链接DLL。 That will allow you to run multiple instances at once (although I'm not sure how useful that will be). 这将允许您一次运行多个实例(尽管我不确定这样做会有多大用处)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM