ufairiya / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Mongoose standalone seems to start slowly #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run mongoose-2.6.exe on Windows XP Home SP3
2. Notice how there is a long delay between the aappearance of the command
window and Mongoose being up.

Please provide any additional information below.

I routinely run Apache, and it seems to start up sightly faster in spite of
its complexity. Also, I used to run PWS (personal IIS), and it started up
almost instantly.

Original issue reported on code.google.com by googl...@springtimesoftware.com on 21 May 2009 at 1:52

GoogleCodeExporter commented 9 years ago
Second the defect.

Using XP Media Center Edition 2002 with latest patches and SP3.

Original comment by roza.cho...@gmail.com on 22 May 2009 at 7:02

GoogleCodeExporter commented 9 years ago
Yeah, I am aware about that. This is due to windows service support: Mongoose 
calls
some Service Control Manager functions that are slow. Without that, startup is 
instant.

I will take a look.

Original comment by valenok on 22 May 2009 at 7:06

GoogleCodeExporter commented 9 years ago

Original comment by valenok on 22 May 2009 at 9:18

GoogleCodeExporter commented 9 years ago
Okay, but note that I am not using the Windows Service version of Mongoose but 
rather
just the standalone file mongoose-2.6.exe. It should not be making any calls to 
the
Service Manager.

Original comment by googl...@springtimesoftware.com on 22 May 2009 at 11:11

GoogleCodeExporter commented 9 years ago
I have removed all service related code from Mongoose, and will use separate
executable, srvany (part of Microsoft Resource Kit) as service launcher.

Submitted change http://code.google.com/p/mongoose/source/detail?r=378
Now, Mongoose starts instantly.
You would need to either wait for release 2.7 or sync to trunk and build 
yourself.

Original comment by valenok on 22 May 2009 at 8:57

GoogleCodeExporter commented 9 years ago
From what I remember, srvany.exe was a not a redistributable file.

Original comment by gilbert....@gmail.com on 23 May 2009 at 4:37

GoogleCodeExporter commented 9 years ago
I was unable to recreate this issue on XP Home or Vista Home Premium.  The 
first time
I ran there was a very short delay (<1 sec), and subsequent times there was no 
delay.

Original comment by gilbert....@gmail.com on 23 May 2009 at 5:05

GoogleCodeExporter commented 9 years ago
The root of the problem was StartServiceCtrlDispatcher() function. Mongoose 
called it
at startup. If mongoose.exe was run by Windows Service Control Manager (SCM), 
that
function did block until service was stopped. If mongoose.exe was run by user, 
that
function return.
For some reason, StartServiceCtrlDispatcher() sometimes takes long time to 
return if
mongoose.exe was started by user, and sometimes it is almost instant. I am 
unable to
tell why. 

Original comment by valenok on 23 May 2009 at 7:10

GoogleCodeExporter commented 9 years ago
About srvany.exe, how can I confirm that? I am not a lawyer.
If this is really the case, I will need to write my own version of it.

Original comment by valenok on 23 May 2009 at 7:13

GoogleCodeExporter commented 9 years ago
Normally a program that can run as both a service and a console application 
will have
a command line parameter to indicate which mode to run.  It would not be too 
hard to
have a command line parameter of "-service" that would indicate to interface 
with the
Service Control Manager.  The installer could also be modified to include the
necessary command line.

Original comment by gilbert....@gmail.com on 23 May 2009 at 7:45

GoogleCodeExporter commented 9 years ago
I do not know how to tell SCM to supply -service argument when it starts 
mongoose.

Original comment by valenok on 23 May 2009 at 7:50

GoogleCodeExporter commented 9 years ago
The program can have another command line option to install itself as a service 
by
calling CreateService.  The command line to the service can be specified as 
part of
the path.  Be sure to put double quotes around the executable path (especially 
if it
will contain spaces.)  The sc command may also specify parameters in the 
binpath by
using double quotes, but it may not be able to put quotes around the executable 
name
possible causing the wrong exe to be launched.  Without quotes around the 
executable
path the OS might think that you wish to run 'C:\Program.exe' with the command 
line
of 'Files\Mongoose\Mongoose.exe -service'.

Original comment by gilbert....@gmail.com on 23 May 2009 at 8:36

GoogleCodeExporter commented 9 years ago
If all Windows users have the SC command installed, it can detect whether 
Mongoose
has been installed and is running as a service. Then you would not need a 
command
option to inform Mongoose whether it is server-based or standalone.

By the way, thanks for being so responsive to user comments. You are a great
developer and your product is wonderful.

Original comment by googl...@springtimesoftware.com on 23 May 2009 at 1:15

GoogleCodeExporter commented 9 years ago
Cool, thanks for the ideas, I will experiment to find what fits best.
Currently, I like external launcher idea more, since it keeps the server free of
service specific code and dependencies.

Original comment by valenok on 23 May 2009 at 5:30

GoogleCodeExporter commented 9 years ago
I agree.

Original comment by googl...@springtimesoftware.com on 23 May 2009 at 5:40