View Full Version : Problems with "Remove Service"
NewsArchive
11-14-2009, 03:49 AM
During our patch routine, we are moving a service into it's own directory.
So, simple enough...
Stop the service
Create new directory
Install new files
Remove the service
Create the service (new location)
Delete old files
Start the service.
(understand the order is a bit weird, but there is tons of code between
those steps, and it just needs to be in that order)
except... for what ever reason, "Remove Service" is not removing the service
right away. It only puts it into "disabled" mode.
I put a message right after "Remove Service" so I could check things, and
noticed, that if I kill the install there, then the "disabled" service goes
away.
Why is it not going away right away? I know I have used this before
successfully.
I realize I am probably overlooking something simple, but it is makimg me
pull my hair out! :D
Anyway, any help would be appreciated.
Oh, and if it matters, the Remove old service, Create new service commands
are in an include separate from the rest of the code.
Don't think it will matter, but just trying to include everything.
Thanks,
-Glenn.
NewsArchive
11-14-2009, 03:50 AM
Hi Glenn,
> During our patch routine, we are moving a service into it's own directory.
> So, simple enough...
> Stop the service
> Create new directory
> Install new files
> Remove the service
> Create the service (new location)
> Delete old files
> Start the service.
Perhaps the service needs some time to stop/remove.
What you can do is to check (e.g. after your Stop Service logic) if the
service is still active (you can do it in a Loop in combination with a
Sleep, etc.).
HTH,
Friedrich
NewsArchive
11-17-2009, 02:38 AM
I was watching the service while this ran.
The service stops almost imeadiately when the Service Stop.
This happens at the beginning of the install, and there is a considerable
amount of code before the remove.
(Note: the remove is conditional based on "old version" information)
I have a message box after the remove, so I can watch the service.
When the remove fires, the startup on the service changes to disabled, but
even after several minutes, it doesn't go away.
If I kill the install process, then the service goes away imeadiately.
It's as if the installer has the service locked somehow, so the remove
cannot complete.
Glenn Paschal
NewsArchive
11-17-2009, 02:38 AM
Additional note:
I also tried this with the service already stopped prior to running the
script.
Same result.
Thanks for your help Fredrich.
-Glenn.
NewsArchive
11-17-2009, 02:39 AM
Hi Glenn,
> Additional note:
> I also tried this with the service already stopped prior to running the
> script.
> Same result.
>
> Thanks for your help Fredrich.
I would suggest to check the return value of the remove service action. It
will return 0 if the service "removed".
If it does not work (return <> 0) then I fear there is a problem in the
service itself (service handling routines).
Friedrich
NewsArchive
11-17-2009, 02:39 AM
already had error checking in there.
return is 0 (which is the weird part)
Here is the code:
Wait Dialog: Update Status Text to "Uninstalling old DX (ePower)
Service..."
Remove Service "TirePowerDataService"
If %_SB_ERRORCODE% Does Not Equal "0" Then
Display Message Box "Uninstall DX Service Error =
%_SB_RETURNEX%\nSB_ER..." -- "Error Uninstalling DX Service"
End
Display Message Box " Run Program %_SB_INSTALLDIR%\dxserver.exe /rs
/..." -- "DEBUG (already done, check it)"
Glenn Paschal
NewsArchive
11-17-2009, 02:40 AM
Hi Glenn,
> already had error checking in there.
> return is 0 (which is the weird part)
>
> Here is the code:
>
> Wait Dialog: Update Status Text to "Uninstalling old DX (ePower)
> Service..."
> Remove Service "TirePowerDataService"
> If %_SB_ERRORCODE% Does Not Equal "0" Then
> Display Message Box "Uninstall DX Service Error =
> %_SB_RETURNEX%\nSB_ER..." -- "Error Uninstalling DX Service"
> End
> Display Message Box " Run Program %_SB_INSTALLDIR%\dxserver.exe /rs
> /..." -- "DEBUG (already done, check it)"
If %_SB_ERRORCODE% returned 0, then the DeleteService() Windows API
succeeeded and the service was stopped and marked for removal. Otherwise,
you would have received an error code > 0.
Please note that the DeleteService function marks a service for deletion
from the service control manager database. The database entry is NOT
removed until all open handles to the service have been closed by calls to
the CloseServiceHandle function.
Friedrich
NewsArchive
11-17-2009, 02:40 AM
Ok, that makes some sense.
My suspicion is that something within my install is what is holding it open,
as it will successfully delete as soon as the installer is gone (either
finished, or killed).
Is there a way I can retrieve information on what handles are open to the
service I am trying to delete?
Glenn Paschal
NewsArchive
11-17-2009, 02:41 AM
Hi Glenn,
> Ok, that makes some sense.
> My suspicion is that something within my install is what is holding it
> open, as it will successfully delete as soon as the installer is gone
> (either finished, or killed).
> Is there a way I can retrieve information on what handles are open to
> the service I am trying to delete?
Are you using "Check Service (Is Service Running)"?
I checked the installer runtime source codes and I think there is a
potential problem in the runtime where a service handle is not closed.
Friedrich
NewsArchive
11-18-2009, 02:42 AM
Hi Glenn,
Please download the following ZIP file (link is valid for 48 hours)
http://www.lindersoft.com/development/20091117/0006.zip
Rename the original 0006.lib in your SetupBuilder \Bin32 folder to, say,
0006_.lib. Then unzip the above ZIP into your \Bin32 folder and recompile
your project.
Does this fix the problem?
Thanks,
Friedrich
--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910
SetupBuilder is Windows installation -- "point. click. ship"
-- Official Comodo Code Signing and SSL Certificate Partner
NewsArchive
11-18-2009, 02:43 AM
Hi Friedrich -
If it's something that you can disclose, in what manner do you make
these URLs that expire?
Thanks.
Jeff Slarve
NewsArchive
11-18-2009, 02:44 AM
Hi Jeff,
> If it's something that you can disclose, in what manner do you make
> these URLs that expire?
We have an automated system here (written in Clarion) that handles all this.
It automatically creates the folder and uploads the file to our FTP server.
In 48 hours (or whatever I have defined), a task will be executed and
connects to our FTP server to remove the file and folder.
Friedrich
NewsArchive
11-18-2009, 02:44 AM
Gee. That's not exciting! <g>
--
Russell B. Eggen
www.radfusion.com
Clarion developers: www.radfusion.com/devs.htm
NewsArchive
11-18-2009, 02:45 AM
I was using Check Service twice. Once for Is Service Running, once for Is
Service Installed.
This fixed it all!!!!!
WOOHOO!!!
My friend, you rock.
With folks like Friedrich on our side, we programmers will take over the
world!
Thank you, sir.
(so, just a thought..., just how geeky is it, when you get all giddy over
receiving "special" libraries?)
Glenn Paschal
NewsArchive
11-18-2009, 02:45 AM
Hi Glenn,
> I was using Check Service twice. Once for Is Service Running, once for Is
> Service Installed.
> This fixed it all!!!!!
> WOOHOO!!!
COOL :)
> My friend, you rock.
>
> With folks like Friedrich on our side, we programmers will take over the
> world!
Thanks so much for your kind words :)
Friedrich
NewsArchive
11-18-2009, 02:46 AM
Geeky?
Not at all <G>
Doesn't everybody ???? <BG>
Jane Fleming
NewsArchive
11-21-2009, 03:29 AM
Cool stuff.
Jeff Slarve
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.