VMware {code} Community
Shigemi
Contributor
Contributor

VixJob_Wait API problems after VixVM_Open API

I have encountered two problems at VixJobWait API after issuing VixVM_Open API.

My C++ program monitors properties of VMs such as POWER_STATE, VMX_PATHNAME, REPLAYING and RUNNING from remote work station and also sometimes issues VixVM_PowerOn or powerOffVM with VIX_VMPOWEROP_FROM_GUEST option to VM.

Problem (I) is that

My AP sometimes crushes just after issuing VixJobWait after VixVM_Open API under debug mode.

Exception code is 0xC0000008(An Invlaid handle was specified) in vix.dll!7c94e4df().

But this error seems not to occur under release mode. So I think this is avoidable.

Problem (II) is that

VixJobWait sometimes never return after VixVM_Open API under the both debug and release modes.

I replaced VixVM_Open API with VixHost_OpenVM API but the same problem still occurs.

The attached program, "Proto_VMware_Vix.cpp" is a simple test program which is simplified from my program in order to reproduce the problem.

I repeated "Power On VM" and "Shutdown VM" from vSphere client GUI while the Proto_VMware_Vix was running.

Problem (I) did not occur but problem (II) occurred several times.

Am I wrong in use of VIX API? Or if you have any advice, please let me know.

My test environment:

VMware vSphere4

VIX API 1.8.1

Visual stadio 2005

0 Kudos
6 Replies
Shigemi
Contributor
Contributor

Sankar,

I found logs are saved in C:\Documentes and Settings\Administrator\Local Settings\Temp\vmware-Administrator folder.

So I tried to reproduce problem, and succeeded to reporduce crush problem at 0x7c94e4df under debug mode 2 times and no return problem at VixJob_Wait API one time.

I uploaded the following log files to Forums:

1st crush: around 3/9 15:10:30 vmware-vix-Administrator-3568.log

2nd crush: around 3/9 15:37:06 vmware-vix-Administrator-5896.log

no return at VixJob_Wait: around 3/9 16:16:55 vmware-vix-Administrator-4272.log

I checked the logs and found "Log Throttled" messages in last 2 logs.

Is size of log file expandable in config.ini? If possible, I will try to reproduce the problem again.

Thanks,

Shigemi

0 Kudos
admin
Immortal
Immortal

I'm not sure exactly what your program is trying to do, really, but I'd suggest trying moving the connectVMware() bit out of the while (1) loop.

Every time you connect to the host, it establishes a separate session, and eventually you will run out of sessions on the host, or at least chew up a lot of resources for no go reason. You could also call VixHost_Disconnect() at the end of every iteration, but I'd recommend the first approach.

In general, we recommend as a best practice to minimize the number of calls to VixHost_Connect() for any given host within the lifetime of a process.

Also, you should be using the "Bool" type for boolean properties retrieved from Vix_GetProperties(), not BOOL. They are different sizes, and could cause undefined behavior with the var-args functions. This type should be defined in the "vm_basic_types.h" header included with the SDK.

rkreitz
Contributor
Contributor

I'd assume that vmrun.exe establishes a seperate connection to the host upon each invocation. Is this accurate? Is there any way to preserve an existing session between vmrun commands?

Thanks,

-Randy

0 Kudos
admin
Immortal
Immortal

Yes, vmrun establishes a separate connection each time it is run, and closes that connection before it exits.

However, if you do have a long lived process, it is more efficient to keep a single connection open for its duration.

Shigemi
Contributor
Contributor

mattrich, thank you for your suggestion.

Regarding keeping a single connection open, my program basically also keep a single connection because it does not issue VixHost_Connect() each time if m_hostHandle != VIX_INVALID_HANDLE. Only if any error occurs in some operation such as VixHost_FindItems(), VixHost_OpenVM() and VixJob_Wait, my program issues VixHost_Disconnect() and set m_hostHandle to VIX_INVALID_HANDLE, and next newly issues VixHost_Connect(). Thus my program keeps a sigle connection.

Regarding BOOL type of Vix_GetProperties(), I was wrong in use. I will replace BOOL with Bool and test again. Thank you for your advise.

And I'd like to test under Vix debug on, but log file is throttled soon. Is size of a log file made large by setting up some parameter in config.ini.?

Shigemi

0 Kudos
Shigemi
Contributor
Contributor

Sankar and all,

this time I could capture the problem.

I modified my program by changing BOOL type to Bool in Vix_GetProperties and performed testing, then the problem, crash at 0x7c94e4df after issuing VixJob_Wait() following VixHost_OpenVM(), occurred soon. So this time vix log was captured.

Trace of my program indicated my program thread was running normally until Mar 10 13:26:20.906. So, I am expecting Vix log may be indicating the trace of the problem after Mar 10 13:26:30.87.

And I am guessing the following log messages may be relating to the problem:

Mar 10 13:26:36.640: app-6116| SSL: connect failed

Mar 10 13:26:36.640: app-6116| SSL_Connect failed when trying to connect to Authd:

I'd like to ask you what the log messages mean and if these are relating to the problem.

I attached vmware-vix-Administrator-4876.log.

Thanks and regards,

Shigemi

0 Kudos