<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>I am writing a virtual machine management front end in Java (Windows 8.1) using the java bindings included in the 4.3.4 SDK. Part of this front end monitors that the VBox processes are up and running by performing a getVersion on them every once in a while. If this call throws we look at the exception and will restart these processes (VBoxWebSrv & VBoxSVC) in an attempt to regain a sane connection again. When I tear things down, I call VirtualBoxManager.disconnect() and VirtualBoxManager.cleanup(). I then set my reference to the VirtualBoxManager to null and set my reference to the IVirtualBox to null (see below)</div><div><br></div><div>VirtualBoxManager mgr;</div><div>IVirtualBox  vboxServer;</div><div>ISession vmPlayerSession;</div><div><br></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">vmPlayerSession.releaseRemote();</p><p style="margin: 0px;" data-mce-style="margin: 0px;">vboxServer.releaseRemote();</p></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">mgr.disconnect();<br> mgr.cleanup();</p></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">vboxServer = null;<br> mgr = null;<br> vmPlayerSession = null;</p></div><div><br></div><div><br></div><div>I then re-launch the VBoxWebSrv (which launched the VBoxSVC) and then perform  the startup/connect sequence:</div><div><br></div><div>VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);</div><div>mgr.connect(VBOX_WEB_SERVER_URI, VBOX_WEB_SERVER_USER, VBOX_WEB_SERVER_PWD);</div><div>vboxServer = mgr.getVBox();</div><div><br></div><div><br></div><div>The problem I'm seeing....</div><div>When I use this newly launched and connected VBoxWeb interface using the java bingings, the webserver seems to hang when I call findMachine. This in turn hangs my java app because it is sitting on the vboxWebServer socket waiting for a reply with an indefinite timeout (can this timeout be set in VBox config somewhere?).</div><div><br></div><div>This only ever happens on a restart of the VBox processes from within my java app. It is as if the java bindings are not entirely cleaned up when I take things down. </div><div><br></div><div>Am I missing something on the cleanup?</div><div><br></div><div>My app stack trace. You can see it stuck on the socketRead</div><div>-------------------------------------------------------------</div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">Thread [WorkUnit508] (Suspended) <br> owns: BufferedInputStream (id=56) <br> owns: HttpURLConnection (id=57) <br> owns: Fiber (id=58) <br> SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method] <br> SocketInputStream.read(byte[], int, int, int) line: 152 <br> SocketInputStream.read(byte[], int, int) line: 122 <br> BufferedInputStream.fill() line: 235 <br> BufferedInputStream.read1(byte[], int, int) line: 275 <br> BufferedInputStream.read(byte[], int, int) line: 334 <br> HttpClient.parseHTTPHeader(MessageHeader, ProgressSource, HttpURLConnection) line: 687 <br> HttpClient.parseHTTP(MessageHeader, ProgressSource, HttpURLConnection) line: 633 <br> HttpURLConnection.getInputStream() line: 1323 <br> HttpURLConnection(HttpURLConnection).getResponseCode() line: 468 <br> HttpClientTransport.readResponseCodeAndMessage() line: 192 <br> HttpTransportPipe.createResponsePacket(Packet, HttpClientTransport) line: 212 <br> HttpTransportPipe.process(Packet) line: 203 <br> HttpTransportPipe.processRequest(Packet) line: 122 <br> DeferredTransportPipe.processRequest(Packet) line: 95 <br> Fiber.__doRun(Tube) line: 626 <br> Fiber._doRun(Tube) line: 585 <br> Fiber.doRun(Tube) line: 570 <br> Fiber.runSync(Tube, Packet) line: 467 <br> SEIStub(Stub).process(Packet, RequestContext, ResponseContextReceiver) line: 308 <br> SEIStub.doProcess(Packet, RequestContext, ResponseContextReceiver) line: 146 <br> SyncMethodHandler.invoke(Object, Object[], RequestContext, ResponseContextReceiver) line: 98 <br> SyncMethodHandler.invoke(Object, Object[]) line: 78 <br> SEIStub.invoke(Object, Method, Object[]) line: 129 <br> $Proxy33.iVirtualBoxFindMachine(String, String) line: not available <br> IVirtualBox.findMachine(String) line: 850 <br> VirtualBoxPlayer.findMachine(String) line: 516 <br> VirtualBoxPlayer.startVirtualMachine(VmAppliance) line: 483 <br> VirtualBoxJob.call() line: 113 <br> VirtualBoxJob(Job).call() line: 1 <br> FutureTask<V>.run() line: 262 <br> ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1145 <br> ThreadPoolExecutor$Worker.run() line: 615 <br> Thread.run() line: 724</p></div><div><br></div><div><br></div><div><br></div><div><br></div><div>The verbose logs from the VBoxWebSrv. It seems to be part way through its internal call to findMachine.</div><div>---------------------------------------------------------------------------------------------------------</div><div><p style="margin: 0px;" data-mce-style="margin: 0px;">00:00:00.015011 main Package type: WINDOWS_64BITS_GENERIC<br>00:00:00.432661 main Pumping COM event queue<br>00:00:00.432661 Watchdog Watchdog thread started<br>00:00:00.432661 Watchdog Watchdog: sleeping 5 seconds<br>00:00:00.509351 SQPmp Socket connection successful: host = default (localhost), port = 18083, master socket = 704<br>00:00:04.984021 SQPmp Request 1 on socket 840 queued for processing (1 items on Q)<br>00:00:04.984021 SQW01 New SOAP thread started<br>00:00:04.984021 SQW01 Processing connection from IP=127.0.0.1 socket=840 (0 out of 1 threads idle)<br>00:00:04.984021 SQW01 -- entering __vbox__IWebsessionManager_USCORElogon<br>00:00:04.988023 SQW01 external authentication library is 'null'<br>00:00:04.989024 SQW01 * ManagedObjectRef::ManagedObjectRef: MOR created for ISession*=0x0000000137ce68 (IUnknown*=0x0000000137cdd8; COM refcount now 3/4), new ID is 1; now 1 objects total<br>00:00:04.989024 SQW01 * WebServiceSession::authenticate: created session object with comptr 0x0000000137ce68, MOR = e3b14703552e6d85-0000000000000001<br>00:00:04.989024 SQW01 * ManagedObjectRef::ManagedObjectRef: MOR created for IVirtualBox*=0x000000012855e8 (IUnknown*=0x00000001292748; COM refcount now 5/6), new ID is 2; now 2 objects total<br>00:00:04.989024 SQW01 VirtualBox object ref is e3b14703552e6d85-0000000000000002<br>00:00:04.989024 SQW01 -- leaving __vbox__IWebsessionManager_USCORElogon, rc: 0x0<br>00:00:04.991026 SQW01 -- entering __vbox__IVirtualBox_USCOREgetVersion<br>00:00:04.991026 SQW01 ManagedObjectRef::findRefFromId(): looking up objref e3b14703552e6d85-0000000000000002<br>00:00:04.991026 SQW01 findComPtrFromId(): returning original IVirtualBox*=0x12855E8 (IUnknown*=0x1292748)<br>00:00:04.991026 SQW01 calling COM method COMGETTER(Version)<br>00:00:04.991026 SQW01 done calling COM method<br>00:00:04.991026 SQW01 convert COM output "version" back to caller format<br>00:00:04.991026 SQW01 done converting COM output "version" back to caller format<br>00:00:04.991026 SQW01 -- leaving __vbox__IVirtualBox_USCOREgetVersion, rc: 0x0 (0)<br>00:00:04.992027 SQPmp Request 2 on socket 900 queued for processing (1 items on Q)<br>00:00:04.992027 SQW02 New SOAP thread started<br>00:00:04.992027 SQW02 Processing connection from IP=127.0.0.1 socket=900 (0 out of 2 threads idle)<br>00:00:04.992027 SQW02 -- entering __vbox__IVirtualBox_USCOREgetVersion<br>00:00:04.992027 SQW02 ManagedObjectRef::findRefFromId(): looking up objref e3b14703552e6d85-0000000000000002<br>00:00:04.992027 SQW02 findComPtrFromId(): returning original IVirtualBox*=0x12855E8 (IUnknown*=0x1292748)<br>00:00:04.992027 SQW02 calling COM method COMGETTER(Version)<br>00:00:04.993027 SQW02 done calling COM method<br>00:00:04.993027 SQW02 convert COM output "version" back to caller format<br>00:00:04.993027 SQW02 done converting COM output "version" back to caller format<br>00:00:04.993027 SQW02 -- leaving __vbox__IVirtualBox_USCOREgetVersion, rc: 0x0 (0)<br>00:00:05.089091 SQW02 -- entering __vbox__IVirtualBox_USCOREfindMachine<br>00:00:05.089091 SQW02 ManagedObjectRef::findRefFromId(): looking up objref e3b14703552e6d85-0000000000000002<br>00:00:05.089091 SQW02 findComPtrFromId(): returning original IVirtualBox*=0x12855E8 (IUnknown*=0x1292748)</p></div><div><span style="font-size: 12pt;">Thats it.</span></div><div><br></div><div><br></div><div><span name="x"></span><span size="4" data-mce-style="font-size: large;" style="font-size: large;"><span style="font-family: helvetica;" data-mce-style="font-family: helvetica;">Allen Granum</span></span><br><span style="font-family: courier new,courier,monaco,monospace,sans-serif;" data-mce-style="font-family: courier new,courier,monaco,monospace,sans-serif;">agranum@leonovus.com</span><br><div><br></div><span size="5" data-mce-style="font-size: x-large;" style="font-size: x-large;"><img style="border: 0pt none;" data-mce-style="border: 0pt none;" src="cid:76af80baa53246f9a80f78d04a608d91d0d9ef75@zimbra" doc="Briefcase/LeoNovus_Blue_Final_140x67.png"></span><br><span size="1" data-mce-style="font-size: xx-small;" style="font-size: xx-small;">1309 Carling Avenue<br>Ottawa, Ontario, Canada K1Z 7L3<br>(613) 722-3232<br>x263</span><br><span name="x"></span><br></div></div></body></html>