aMule Forum
English => Feature requests => Topic started by: Vollstrecker on July 21, 2005, 02:36:46 PM
-
Hi,
while playing around with amule and the posibillity to startup amuleweb automatically I saw, that amuleweb isn't shutdown when I close amule. Maybe it's because I had to kill amule, but after 5 tries I have 5 amuleweb processes. One for each try.
I would suggest, that either amule kills amuleweb at shutdown (or kill) or that amule checks if amuleweb is already running, and then don't start another instance.
-
That was an original idea, but implementation seems buggy ...
-
// Kill amuleweb if running
if (webserver_pid) {
printf("Killing amuleweb instance...\n");
wxKillError rc;
wxKill(webserver_pid,wxSIGKILL, &rc);
printf("Killed!\n");
}
Maybe if you don't kill it... :P
-
I don't want to, but sometimes it is needed. I wanted to test how many downloads it can handle, and with atm 649 on an remote fs appear some errors. Sometimes I just have to, so it would be nice, if amule would check if amuleweb is already running.
-
And do what if it's running?
-
wxKill(webserver_pid,wxSIGKILL, &rc);
Why killing? Why not just terminating it? Doesn't wx have a wxSIGTERM?
-
Originally posted by Kry
And do what if it's running?
Nothing. When I killed the new ones, I can use the old one.
-
Nonsense. amuleweb connects to a running aMule, and DOESN'T reconnect to it if it's lost. So you can't use the old one with a newly running aMule.
-
Maybe I killed the false one, but it should be no problem to reconnect. Or at the other side, you could let amuleweb die when it loses connection.
-
Well, certainly, it should quit if it loses the connection and it has no stdin.
-
werner@Werner1:~$ ps -A | grep amule
12480 ? 00:00:00 amuleweb
werner@Werner1:~$
-
Yeah, that did make a lot of sense.
Now, if you could explain what you pretend to achieve by that lines...
-
Originally posted by ken
Well, certainly, it should quit if it loses the connection and it has no stdin.
Originally posted by Vollstrecker
werner@Werner1:~$ ps -A | grep amule
12480 ? 00:00:00 amuleweb
werner@Werner1:~$
Originally posted by kry
Now, if you could explain what you pretend to achieve by that lines...
Got it now?
There is no amule or amuled process running, so it has lost connection. I closed the console where I started amule, so it has no stdin, stdout or stderr. But it does run.
Or was that wath ken posted not the behaviour? If that was a suggestion, I would be glad to see that implemented.
-
It was a sugestion.
-
Exit when connection is failed is wrong.
Instead, on every request from browser amuleweb must perform one more connection attempt. If succeded, return to normal operation; if not - display error page telling the nature of the problem, like "connection failed/timeout/no route to host/ etc".
-
perform one more connection attempt
wrong. Instead, it should check the "existing" connection, whether it is still connected, or not. I agree with the error page.
-
wrong. Instead, it should check the "existing" connection
No, that's wrong. Consider that your existing connection is dead (no matter reason), and you're not "still connected". Now what you do ? Silently exit ?!
You can check whether existing connection is still "alive" whatever it means, but be ready that it's not. And if it's not - you have to reconnect.
-
Jep, and when you implemented that reconnect, amule can check if amulewb is already running, and then not starting a new one.
-
amule can check if amulewb is already running
I have serious doubt about this. How exactly do you check this without knowing pid upfront ? Not that this is impossible, but neither trivial.
-
You can check whether existing connection is still "alive"
That was what I meant.
And if it's not - you have to reconnect.
nope, instead
if not - display error page
The error page might have an option to try to reconnect (option == a link)
amule can check if amulewb is already running
I have serious doubt about this. How exactly do you check this without knowing pid upfront ? Not that this is impossible, but neither trivial.
You can check whether amuleweb is running or not (not trivial, as lfroen said), but you'll never be able to find out whether this running webserver instance wanted to connect to you.
Just imagine, that you start amuleweb, that connects to amule somewhere else. Then you decide to run amule too on this local machine. Amule would find out that a webserver is running, so it wouldn't start another one, but now it should.
-
You can check if you get an answer on webserver-port. 4711 I think. When you get an answer on this port, amuleweb is running. I don't think that it works if you want to start a second one, on the same port, because the two amulewebs don't know to which of them you are talking. No matter if it wants to connect to you or not.
-
You can check if you get an answer on webserver-port. 4711 I think.
Yes, it is the default port. But nothing keeps users from changing it, so...
-
When I see right, you can specify only the port where amule accepts EC, not the port amuleweb listens on commandline. So I think that port is in amule.conf or remote.conf. So amule can see which port he has to check.
-
When I see right, you can specify only the port where amule accepts EC, not the port amuleweb listens on commandline.
From amuleweb man page:
-s, --server-port=
Webserver's HTTP port. This is the port you can point your browser to (default: 4711)
So I think that port is in amule.conf or remote.conf. So amule can see which port he has to check.
Well, remote.conf... which user? Amuleweb can be run by any user, not necessarily by the one who runs amule. The only requirement is that (s)he: 1) has an appropriate remote.conf file (or any other name, see the -f, --config-file command-line option), 2) supplies adequate command-line parameters, 3) answers the questions from amuleweb.
Actually, it could be implemented:
1) amule check for a process with a command name "amuleweb{DLG}"
2) check the command-line of the process for a -s switch
3) if not found, get the owner of the process
4) if owner of the process is not the current user, and we are not root, then give up
5) check the command-line of the process for a -f switch, if not found use "remote.conf" as config file name
6) read config file from the detected user's home directory.
I think it 1) doesn't wort the effort, 2) opens security holes, 3) people used to not like when a process just reads their secret files without a notice.
If you disagree with the above, just let me know :)
PS: And we still didn't care about things like:
1) what if a user renames amuleweb to something else, just for fun? (like amule-webserver, and leaves amuleweb as a symlink to the new name)
2) what if I use amuleweb to monitor another amule(d) somewhere else?
3) amuleweb behaves differently when started manually, manually with the -L switch, automatically...
So, certain cases can be detected, but it's more error-prone than useful.
-
Another optoin would be, that amule sends a message to conected amuleweb-processes, that it terminates. Amuleweb can then terminate, too. Without the amule process where it is connected to it is useless, and if somebody complains about that, you could add an option to remote.conf that lets amuleweb be running.
-
I also thought of it, but currently EC uses a polling mechanism (client ask something, core answers). No way to send a message from core to client. This would require rewriting EC sockets, etc (which will be done soon, so this might get implemented).
However, this is not a solution for situations when amule exits abnormally (i.e. crashes).
-
Without the amule process where it is connected to it is useless
did you bothered to read thread above ?
If amule is unexpectedly quit - webserver should notify user about it. That's what it exist for - monitor remote amule.
Actually, it could be implemented:
1) amule check for a process with a command name "amuleweb{DLG}"
2) check the command-line of the process for a -s switch
3) if not found, get the owner of the process
4) if owner of the process is not the current user, and we are not root, then give up
5) check the command-line of the process for a -f switch, if not found use "remote.conf" as config file name
GonoszTopi: this is all over OS dependent. Even when available, you may not have permissions to access command line of other user's process. Consider situaltion when amuleweb started under other username.
But, let's stay focused. GonoszTopi - instead of trying to think about some imaginary scenario, where several amule's and amuleweb distributed over network and communicate with each other, let's make common case work correctly. And THEN think about exceptions.
Have you ever heard the word "usability" ?
The common case is "amuleweb" is started by amule (obviously on same machine) but amule(d) has quit unexpectedly. What we do ?
The error page might have an option to try to reconnect (option == a link)
You did not answered WHY it should be AN OPTION ? Why user would NOT want to reconnect ? Does (s)he enjoy looking in the error page ? Instead of including such link, just do it without bothering to ask user. This will provide match better experience.
-
Now, to the case of "amule set to start amuleweb automatically, but another one trying to reconnect". Obviously, both has been started with same options, and trying to listen on the same port. So, when amuleweb encountered situation that port can't be bound, it must simply quit, and we left with one amuleweb that reconnects and everything works as usual.
Even if user changed port in-between, nothing wrong happens - we will have 2 amuleweb's serving same page on 2 different ports.
-
You did not answered WHY it should be AN OPTION ? Why user would NOT want to reconnect ? Does (s)he enjoy looking in the error page ? Instead of including such link, just do it without bothering to ask user. This will provide match better experience.
And did you think of HOW that "unexpectedly quit amule" gets restarted?
There should be an error page, that notifies user that something is wrong. Then the user can take appropriate steps (i.e. restart amule), and reconnect.
For being user-friendly, amuleweb can first try to reconnect and if that fails, only then displaying an error page (to deal with auto-restart scripts).
-
GonoszTopi: this is all over OS dependent. Even when available, you may not have permissions to access command line of other user's process. Consider situaltion when amuleweb started under other username.
But, let's stay focused. GonoszTopi - instead of trying to think about some imaginary scenario, where several amule's and amuleweb distributed over network and communicate with each other, let's make common case work correctly. And THEN think about exceptions.
Have you ever heard the word "usability" ?
describing difficulties and drawbacks != implementing
Consider situaltion when amuleweb started under other username.
see 4)
-
When amuleweb terminates, the user can see too that something went wrong. A page that tells you that something abnormal happend, or no page are the saem in this situation. You see something happend and have to look.
-
Originally posted by GonoszTopi
When I see right, you can specify only the port where amule accepts EC, not the port amuleweb listens on commandline.
From amuleweb man page:
-s, --server-port=
Webserver's HTTP port. This is the port you can point your browser to (default: 4711)
I double checked now. I see -s, but not what it means:
Werner1:/usr/src/amule/build/deb/cvs# amuleweb --help
Verwendung: amuleweb [--help] [-h ] [-p ] [-P ] [-f ] [-q] [-v] [-l ] [-w] [--create-config-from ] [--version] [-t ] [-s ] [-z] [-Z] [-A ] [-G ] [-a] [-d] [-L] [--amule-config-file ]
--help Show this help text.
-h, --host= Host where aMule is running. (default: localhost)
-p, --port= aMule's port for External Connection. (default: 4712)
-P, --password= External Connection password.
-f, --config-file= Read configuration from file.
-q, --quiet Do not print any output to stdout.
-v, --verbose Be verbose - show also debug messages.
-l, --locale= Sets program locale (language).
-w, --write-config Write command line options to config file.
--create-config-from= Creates config file based on aMule's config file.
--version Print program version.
-t, --template= Loads template
-s, --sWerner1:/usr/src/amule/build/deb/cvs#
-
ok
thats a error in the --help command, but gonszotopi also said MAN PAGE ;) reading helps :P
-
wxCmdLineParser has some bugs in displaying help strings... hopefully it will be solved soon.