VMware {code} Community
KudoC
Contributor
Contributor
Jump to solution

VMRunProgramInGuest (Perl version) returns unknown error in multithreads environment

Hi,

I want to develope a automation test for VMWare Workstation.

I have two thread which open two diffent VMs and run command.

After some simple testing, I find find that once a thread finish its command's job, it will cause another thread be terminate, and return error code = 1 (Unknown error).

I guess that there might be something wrong of VMware::Vix::API::Job::Wait for multi-thread environment.

Are there anyone who have the same experience? And please tell me what should I do.

The attachment is my test sample code.

You maybe see "Thread 2 terminated abnormally: VMRunProgramInGuest() failed, 1 Unknown error", when you run this test with two VMs logining on and exit one of calculator program.

Thanks a lot.

ps.

1. My test is implemented by Perl, including perl threads.

2. My environment is VMWare Workstation 6.5.3-185404 with VIX API v.1.8.1

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

Can you try it with moving the call to HostConnect() before starting the threads, and calling HostDisconnect() after both threads finish?

I believe the version of VIX that shipped with Workstation 6.5 had handle sharing with host handles, so calling disconnect from one thread will affect the operations on the other thread (since both are children of the same logical host object).

View solution in original post

Reply
0 Kudos
3 Replies
lemke
VMware Employee
VMware Employee
Jump to solution

There's been no testing at all for Perl using threads. The underlying C should have no issues with what you're doing, but there's been no attempt at all to make the binding layer thread-safe.

admin
Immortal
Immortal
Jump to solution

Can you try it with moving the call to HostConnect() before starting the threads, and calling HostDisconnect() after both threads finish?

I believe the version of VIX that shipped with Workstation 6.5 had handle sharing with host handles, so calling disconnect from one thread will affect the operations on the other thread (since both are children of the same logical host object).

Reply
0 Kudos
KudoC
Contributor
Contributor
Jump to solution

Yes, seperating HostConnect/HostDisconnect from thread beginning helps solving this problem.

Thank you very much.

Best regards,

Kudo

Reply
0 Kudos