vboxweb-service.sh assumes single instance of vboxwebsrv

Discussions related to using VirtualBox on Linux hosts.
Post Reply
ArthurW
Posts: 2
Joined: 23. Aug 2017, 19:09

vboxweb-service.sh assumes single instance of vboxwebsrv

Post by ArthurW »

Hello,

Currently the vboxweb-service.sh init script assumes that only a single instance of vboxwebsrv will be running on the system – if another user starts their own instance of vboxwebsrv the script will fail to work properly (it will shut down instances it did not launch and/or will fail to create an instance of vboxwebsrv if any other user of the system has already launched it under their own account).

I experienced concurrency issues at boot when another user launched vboxwebsrv in their crontab with @reboot. vboxweb-service.sh only checks for the process name, not the userid under which the process is running so can report the service as defined in the config files ($VBOXWEB_USER, $VBOXWEB_HOST etc) has started when in fact it has not.

Attached is modified version of vboxweb-service.sh that addresses this issue - it ignores other instances of vboxwebsrv and limits itself to managing instances of vboxwebsrv launched as the user defined by VBOXWEB_USER in the config files. I'd appreciate feedback on my modifications before I submit it as a patch.

I also notice that vboxwebsrv does not exit if it can not bind a socket, is this a bug or by design? Not binding a socket does result in a fault in the log - though this seems odd as what is the point of a web service that cannot talk to the network? It also makes it harder to handle the situation where another process has bound the default socket. The modified vboxwebservice.sh attached doesn't address that scenario as the service does technically start up.

Longer term it may be neater for the vboxweb-service script to handle launching vboxweb under multiple different userids (I use multiple instances to segregate "production" VMs, which run under "vbox" user, from my experimental VMs which run under my personal account on the server, managed through phpvirtualbox - having them listed side by side under a single account increases the risk of accidentally stopping a "production" VM)

regards,

Arthur
vboxweb-service.sh.gz
(2.14 KiB) Downloaded 27 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: vboxweb-service.sh assumes single instance of vboxwebsrv

Post by socratis »

Your best option would be to send an e-mail to the developer's list with the description and the patch. Make sure to read the How to contribute page, if only to sign your e-mail to the list with the MIT license, in order for the changes to be accepted. Typically a statement in your e-mail like the following, is more than enough:
The attached patch is published under the terms of the MIT license.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply