bugmldonkey, a multi-networks file-sharing client - Bugs: bug #11514, start option "-daemon"...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #11514: start option "-daemon" does not work anymore

Submitter:  Knocker <knocker>
Submitted:  Fri 07 Jan 2005 08:16:35 AM UTC
   
 
Category:  Core Severity:  1 - Wish
Item Group:  Feature request Status:  Postponed
Assigned to:  None Open/Closed:  Closed
Release:  2.5.30.15 Release: 
Operating System:  None Binaries Origin:  None
CPU type:  None

Jump to the original submission

Fri 27 May 2005 10:03:59 PM UTC, comment #26: 

transformed into feature request for later work

spiralvoice <spiralvoice>
Group administrator
Thu 26 May 2005 10:17:26 AM UTC, comment #25: 
spiralvoice <spiralvoice>
Group administrator
Thu 26 May 2005 10:15:55 AM UTC, comment #24: 

"- the bug does not exist in 2.5.16w1"

I don´t think this is true. The patch below shows that also
this core prints "Core stopped" in its logfile when started
with "-daemon".
Yet the bug looks different, from the logfile:
===============================================================
26/ 5, 12:11:04: Core stopped
26/ 5, 12:11:04: Saving shared files and sources
26/ 5, 12:11:04: Options correctly saved
26/ 5, 12:13:35: Core stopped
26/ 5, 12:13:35: Saving shared files and sources
26/ 5, 12:13:35: Options correctly saved
===============================================================
--- ../cvs/knocker-2-5-16w1/src/daemon/driver/driverMain.ml     2005-05-19 00:13:15.000000000 +0200
+++ ./src/daemon/driver/driverMain.ml   2005-05-26 12:08:06.000000000 +0200
@@ -505,10 +505,10 @@
   CommonGlobals.print_localtime ();
   lprintf (_b "Core started\n");
   core_included := true;
-(*
+
   CommonGlobals.do_at_exit (fun _ -> lprintf "Core stopped\n");
   CommonGlobals.do_at_exit (fun _ -> CommonGlobals.print_localtime ());
-*)
+
   if not !keep_console_output then begin
       lprintf (_b "Disabling output to console, to enable: stdout true\n");
===============================================================
This is the result of the patch from 2004/04/06 which solved
another bug, so I still think removing "-daemon" is the way to
go as we have an easy replacement.

spiralvoice <spiralvoice>
Group administrator
Thu 19 May 2005 02:46:16 AM UTC, comment #23: 

Some new thoughts about that one:
- the bug does not exist in 2.5.16w1
- I think it was introduced in 2.5.18:
2004/04/06: Fabrice
  - CommonGlobals: only execute 'do_at_exit' in the main process, not
      in the forked ones (should solve bug #7738).

spiralvoice <spiralvoice>
Group administrator
Wed 18 May 2005 09:37:08 PM UTC, comment #22: 

Updated patch so it prints infos when "mlnet -daemon" was executed:
"Option -daemon was removed.
Use 'mlnet > /dev/null 2>&1 &' instead, exiting..."

The core will exit so users are forced to update their scripts.

Most users won´t notice as most common distros don´t use that function anyway.

spiralvoice <spiralvoice>
Group administrator
Wed 18 May 2005 09:08:51 PM UTC, comment #21: 

Here is a summary how MLDonkey is started on some distros:

Gentoo (mldonkey.initd): /usr/bin/mlnet &>${LOG} &

Debian: uses /usr/bin/mldonkey-server which daemonizes mlnet itself with "--daemon" option

Fedora(ATrpms): http://dl.atrpms.net/production/sources/fedora-4-i386/atrpms/mldonkey-2.5.28.1-43.rhfc3.92.at.src.rpm
exec /usr/@lib@/mldonkey/mlnet >> /mldonkey.log 2>&1 < /dev/null" &

PLD: ftp://ftp.pld-linux.org/dists/2.0/PLD/SRPMS/SRPMS/mldonkey-2.5.30.1-1.src.rpm
exec $MLDONKEY_PATH > ${LOG:-/dev/null} 2>&1

spiralvoice <spiralvoice>
Group administrator
Wed 18 May 2005 09:34:34 AM UTC, comment #20: 

As I wrote in comment #7 starting the core with

mlnet > /dev/null 2>&1 &

works without problems. Having a function which causes data loss
is also not a good deal. I spent already two hours in debugging
but did not succeed. If no one comes up with a better solution
package maintainers should change to the other way starting the core.

spiralvoice <spiralvoice>
Group administrator
Wed 18 May 2005 07:21:53 AM UTC, comment #19: 

removing functionality used by those who dont use/have init scripts for mldonkey isnt very user friendly and is a wontfix and not a fix

Anonymous
Tue 17 May 2005 08:17:38 PM UTC, comment #18: 

I think we should drop "-daemon", patch attached.

spiralvoice <spiralvoice>
Group administrator
Tue 17 May 2005 08:07:33 PM UTC, comment #17: 

It seems the core goes through the stop process once it is started.

gentoo a # ps axHu | grep mlnet
root      2970  0.7  2.8  31896 18112 ?        Ssl  21:58   0:03 ./mlnet -daemon
root      2970  0.0  2.8  31896 18112 ?        SNsl 21:58   0:00 ./mlnet -daemon

Process 2969 does not exist anymore, so I think the main thread
is dropped immediatly after core start because when "MlUnix.detach_daemon ()"
is called the core already is threaded. See the comment in the code:
" (* Question: is-it not to late to go in background ? Is-it possible that
we have started some threads already ? What happens then ? *)"

The answer to one is yes, two also, three? Core stops main thread and produces this bug.

spiralvoice <spiralvoice>
Group administrator
Tue 17 May 2005 08:05:07 PM UTC, comment #16: 

From logfile:

Welcome to MLdonkey
Starting with pid 2969
Options correctly saved on localtime: 17/ 5, 21:58:10
Core started on localtime: 17/ 5, 21:58:10
Disabling output to console, to enable: stdout true


threads are enabled!!

Options correctly saved on localtime: 17/ 5, 21:58:10
 on localtime: 17/ 5, 21:58:10
Core stopped
Core stopped on localtime: 17/ 5, 21:58:10

spiralvoice <spiralvoice>
Group administrator
Tue 17 May 2005 08:00:57 PM UTC, comment #15: 

It seems daemon´izing the core does not work properly. For debugging I tested this patch:

--- ./src/daemon/driver/driverMain.ml   2005-05-17 21:34:42.000000000 +0200
+++ ./src/daemon/driver/driverMain.ml   2005-05-17 21:39:11.000000000 +0200
@@ -659,10 +659,10 @@
           ()
         end else
               close_log ();
-
+
+    if BasicSocket.has_threads () then lprintf "\n\nthreads are enabled!!\n\n";

 (* Question: is-it not to late to go in background ? Is-it possible that
 we have started some threads already ? What happens then ? *)
       if !daemon then MlUnix.detach_daemon ()
     end
-

spiralvoice <spiralvoice>
Group administrator
Mon 09 May 2005 12:58:54 PM UTC, comment #14: 
spiralvoice <spiralvoice>
Group administrator
Mon 09 May 2005 11:42:35 AM UTC, comment #13: 

With MinGW core CTRL+C does not save ini files and config_files_space.tmp is not deleted.

Of course it does not because in ./src/config/mingw/mlUnix.ml
let set_signal signal f = ()

spiralvoice <spiralvoice>
Group administrator
Thu 14 Apr 2005 10:45:49 PM UTC, comment #12: 

the problem is still in 2-5-30-5
I started with
#./mlnet -log_file log -deamon

end of log file:

>Core started on localtime: 15/ 4, 00:39:06
>Disabling output to console, to enable: stdout true
>Options correctly saved on localtime: 15/ 4, 00:39:08
> on localtime: 15/ 4, 00:39:08
>Core stopped
>Core stopped on localtime: 15/ 4, 00:39:08


the temp file "config_files_space.tmp" is gone
BUT the core is running

Anonymous
Fri 01 Apr 2005 05:45:58 PM UTC, comment #11: 

kempston and whoever had/has this problem: could you please check if the problem, that you ini files are not saved, is fixed in 2.5.30ac ?

Amorphous <amorphous>
Wed 16 Mar 2005 09:08:11 PM UTC, comment #10: 
Amorphous <amorphous>
Wed 16 Mar 2005 09:04:32 PM UTC, comment #9: 

perhaps my revision 228 fixes some of these problems.
https://opensvn.csie.org/viewcvs.cgi?root=mlnet&rev=228&view=rev

Amorphous <amorphous>
Thu 03 Mar 2005 01:19:42 PM UTC, comment #8: 


"from driverMain.ml:

CommonGlobals.do_at_exit (fun _ ->
BasicSocket.close_all ();
Sys.remove security_space_filename;
DriverInteractive.save_config ();

CommonGlobals.print_localtime ();
lprintf (_b "Core stopped\n"));

These commands should be executed every time the core is stopped, regardless if through process signals (SIGTERM etc.), the "kill"-command or CTRL+C
"

These commands are probably not executed everytime the core is stopped ...

Currently I am lacking time, to take a closer look at it and debug it ... however:

The first command should -better must- fail with an exception (permission denied), if mldonkey is stared with the -run_as_user or -run_as_uid options.
Remember, a setuid can only be done with root-privileges and the sockets are bound prior the setuid with root-privileges. Socket-binding with root priviledges while not running the core with root privileges is the purpose of the above options, right?
... I bet due to an exception the game is over for the remaining commands then ...

Not sure about a plain -daemon option, without an additional setuid, a plain -daemon should save the ini-files.

One can check the neccessary permissions to close the sockets in different startup-configurations with:

ls -al /proc/$(($(ps -C mlnet -o pid --no-header f|head -n1)))/fd|grep socket


Fritz Mock <surround>
Thu 10 Feb 2005 12:23:15 PM UTC, comment #7: 

It seems that "-daemon" is the reason why ini files are not saved. Here I normally start mlnet like this:

/usr/local/bin/nice -n 10 /usr/local/bin/chroot /mnt/mlnet /mlnet > /dev/null 2>&1 &

so, no "-daemon", thats the reason I never experienced that bug...

spiralvoice <spiralvoice>
Group administrator
Thu 10 Feb 2005 06:41:24 AM UTC, comment #6: 

config_files_space.tmp is gone after kill

starting: mlnet -daemon
          --> *.ini not saved & no "Core stopped" in logfile
starting: mlnet -stdout
          --> *.ini saved & and "Core stopped" on console

Anonymous
Tue 08 Feb 2005 07:48:21 PM UTC, comment #5: 

from driverMain.ml:

  CommonGlobals.do_at_exit (fun _ ->
      BasicSocket.close_all ();
      Sys.remove security_space_filename;
      DriverInteractive.save_config ();

      CommonGlobals.print_localtime ();
      lprintf (_b "Core stopped\n"));

These commands should be executed every time the core is stopped, regardless if through process signals (SIGTERM etc.), the "kill"-command or CTRL+C

Do you get any messages in logfile (try starting with ./mlnet -stdout) when you issue the kill command in telnet interface?

spiralvoice <spiralvoice>
Group administrator
Tue 08 Feb 2005 07:37:06 PM UTC, comment #4: 

I tried it with 2-5-28r ten times or more and each time the inis
were saved wken "kill" was issued through telnet, HTML or sancho.

What about config_files_space.tmp?
Is this file deleted when you kill the core?

spiralvoice <spiralvoice>
Group administrator
Tue 08 Feb 2005 10:40:29 AM UTC, comment #3: 

I can vertify this bug, tried it several times.
version 2-5-28-r

Anonymous
Wed 19 Jan 2005 03:37:27 PM UTC, comment #2: 

I tried it several times before posting this bug.

My stats are posted here:
http://mldonkey.org/portal/modules.php?op=modload&name=phpBB2&file=viewtopic&t=5166

And Surround confirmed it.

Knocker <knocker>
Mon 10 Jan 2005 06:24:21 PM UTC, comment #1: 

Can´t confirm that bug with 2-5-28m. Actually I never saw this bug.

Two files compared:
- before killing the core
-rw-r--r--    1 root     root      2653089 Jan 10 19:13 file_sources.ini
-rw-r--r--    1 root     root      2632173 Jan 10 18:53 file_sources.ini.old
- after killing the core on 7:21pm
-rw-r--r--    1 root     root      2662071 Jan 10 19:21 file_sources.ini
-rw-r--r--    1 root     root      2653089 Jan 10 19:13 file_sources.ini.old

Here the core directory before killing the core via telnet:
drwxr-xr-x    2 root     65534        1024 Jun 28  2004 .mldonkey
drwxr-xr-x    2 mlnet    mlnet        1024 Dec 14 13:41 backup
-rw-r--r--    1 root     root         1349 Jan 10 19:13 bittorrent.ini
-rw-r--r--    1 root     root         1349 Jan 10 18:53 bittorrent.ini.old
-rw-r--r--    1 root     root            1 Nov 16 15:13 comments.met
-rw-r--r--    1 root     root     10485760 Jan 10 12:33 config_files_space.tmp
drwxr-xr-x    2 root     root         1024 Aug 13 09:31 dev
-rw-r--r--    1 root     65534        1685 Dec  4 16:47 directconnect.ini
-rw-r--r--    1 root     root        11102 Jan 10 19:13 donkey.ini
-rw-r--r--    1 root     root        11102 Jan 10 18:53 donkey.ini.old
-rw-r--r--    1 root     root        22377 Jan 10 19:13 downloads.ini
-rw-r--r--    1 root     root        22377 Jan 10 18:53 downloads.ini.old
drwxr-xr-x    2 mlnet    mlnet        1024 Feb 10  2004 etc
-rw-r--r--    1 root     root         1303 Jan 10 19:13 fasttrack.ini
-rw-r--r--    1 root     root         1303 Jan 10 18:53 fasttrack.ini.old
-rw-r--r--    1 root     root          951 Jan 10 19:13 fileTP.ini
-rw-r--r--    1 root     root          951 Jan 10 18:53 fileTP.ini.old
-rw-r--r--    1 root     root      2653089 Jan 10 19:13 file_sources.ini
-rw-r--r--    1 root     root      2632173 Jan 10 18:53 file_sources.ini.old
-rw-r--r--    1 root     root       607369 Jan 10 19:13 files.ini
-rw-r--r--    1 root     root       607310 Jan 10 18:53 files.ini.old
-rw-r--r--    1 root     root          116 Jan 10 19:13 friends.ini
-rw-r--r--    1 root     root          116 Jan 10 18:53 friends.ini.old
-rw-r--r--    1 root     root         1793 Jan 10 19:13 gnutella.ini
-rw-r--r--    1 root     root         1793 Jan 10 18:53 gnutella.ini.old
-rw-r--r--    1 root     root         2197 Jan 10 19:13 gnutella2.ini
-rw-r--r--    1 root     root         2197 Jan 10 18:53 gnutella2.ini.old
-rw-r--r--    1 root     root      2520205 Jan  9 06:45 guarding.p2p
drwxr-xr-x    2 mlnet    mlnet        1024 May 30  2004 lib
-rw-------    1 root     root         3370 Jan  4 18:50 messages.log
-rwxr-xr-x    1 root     65534         916 Nov 16 15:13 mldonkey_submit
-rwxr-xr-x    1 root     root      4042984 Jan 10 12:32 mlnet
-rwxr--r--    1 root     65534         291 Nov 16 15:13 mlsubmit.reg
-rw-r--r--    1 root     65534          48 Jan 10 19:13 onlinesig.dat
-rw-r--r--    1 root     65534        1260 Dec  4 16:47 opennap.ini
drwxr-xr-x    2 root     root         1024 Dec  4 16:48 searches
-rw-r--r--    1 root     root         2095 Jan 10 19:13 searches.ini
-rw-r--r--    1 root     root         2095 Jan 10 18:53 searches.ini.old
-rw-r--r--    1 root     root        60413 Jan 10 19:13 servers.ini
-rw-r--r--    1 root     root        60478 Jan 10 18:53 servers.ini.old
-rw-r--r--    1 root     root        61025 Jan 10 19:13 shared_files_new.ini
-rw-r--r--    1 root     root        61025 Jan 10 18:53 shared_files_new.ini.old
drwxr-xr-x    8 mlnet    mlnet        1024 Aug 11 01:24 shares
-rw-r--r--    1 root     65534        1270 Dec  4 16:47 soulseek.ini
-rw-r--r--    1 root     root         1521 Jan 10 19:13 stats.ini
-rw-r--r--    1 root     root         1521 Jan 10 18:53 stats.ini.old
-rw-r--r--    1 root     root        10113 Jan 10 19:13 stats_mod.ini
-rw-r--r--    1 root     root        10113 Jan 10 18:53 stats_mod.ini.old
drwxr-xr-x    5 mlnet    mlnet        2048 Jun 21  2004 torrents

Here the directory after killing the core:

drwxr-xr-x    2 root     65534        1024 Jun 28  2004 .mldonkey
drwxr-xr-x    2 mlnet    mlnet        1024 Dec 14 13:41 backup
-rw-r--r--    1 root     root         1349 Jan 10 19:21 bittorrent.ini
-rw-r--r--    1 root     root         1349 Jan 10 19:13 bittorrent.ini.old
-rw-r--r--    1 root     root            1 Nov 16 15:13 comments.met
drwxr-xr-x    2 root     root         1024 Aug 13 09:31 dev
-rw-r--r--    1 root     65534        1685 Dec  4 16:47 directconnect.ini
-rw-r--r--    1 root     root        11102 Jan 10 19:21 donkey.ini
-rw-r--r--    1 root     root        11102 Jan 10 19:13 donkey.ini.old
-rw-r--r--    1 root     root        22377 Jan 10 19:20 downloads.ini
-rw-r--r--    1 root     root        22377 Jan 10 19:13 downloads.ini.old
drwxr-xr-x    2 mlnet    mlnet        1024 Feb 10  2004 etc
-rw-r--r--    1 root     root         1303 Jan 10 19:21 fasttrack.ini
-rw-r--r--    1 root     root         1303 Jan 10 19:13 fasttrack.ini.old
-rw-r--r--    1 root     root          951 Jan 10 19:21 fileTP.ini
-rw-r--r--    1 root     root          951 Jan 10 19:13 fileTP.ini.old
-rw-r--r--    1 root     root      2662071 Jan 10 19:21 file_sources.ini
-rw-r--r--    1 root     root      2653089 Jan 10 19:13 file_sources.ini.old
-rw-r--r--    1 root     root       607311 Jan 10 19:21 files.ini
-rw-r--r--    1 root     root       607369 Jan 10 19:13 files.ini.old
-rw-r--r--    1 root     root          116 Jan 10 19:21 friends.ini
-rw-r--r--    1 root     root          116 Jan 10 19:13 friends.ini.old
-rw-r--r--    1 root     root         1793 Jan 10 19:21 gnutella.ini
-rw-r--r--    1 root     root         1793 Jan 10 19:13 gnutella.ini.old
-rw-r--r--    1 root     root         2197 Jan 10 19:21 gnutella2.ini
-rw-r--r--    1 root     root         2197 Jan 10 19:13 gnutella2.ini.old
-rw-r--r--    1 root     root      2520205 Jan  9 06:45 guarding.p2p
drwxr-xr-x    2 mlnet    mlnet        1024 May 30  2004 lib
-rw-------    1 root     root         3370 Jan  4 18:50 messages.log
-rwxr-xr-x    1 root     65534         916 Nov 16 15:13 mldonkey_submit
-rwxr-xr-x    1 root     root      4042984 Jan 10 12:32 mlnet
-rwxr--r--    1 root     65534         291 Nov 16 15:13 mlsubmit.reg
-rw-r--r--    1 root     65534          48 Jan 10 19:20 onlinesig.dat
-rw-r--r--    1 root     65534        1260 Dec  4 16:47 opennap.ini
drwxr-xr-x    2 root     root         1024 Dec  4 16:48 searches
-rw-r--r--    1 root     root         2095 Jan 10 19:21 searches.ini
-rw-r--r--    1 root     root         2095 Jan 10 19:13 searches.ini.old
-rw-r--r--    1 root     root        60438 Jan 10 19:21 servers.ini
-rw-r--r--    1 root     root        60413 Jan 10 19:13 servers.ini.old
-rw-r--r--    1 root     root        61025 Jan 10 19:20 shared_files_new.ini
-rw-r--r--    1 root     root        61025 Jan 10 19:13 shared_files_new.ini.old
drwxr-xr-x    8 mlnet    mlnet        1024 Aug 11 01:24 shares
-rw-r--r--    1 root     65534        1270 Dec  4 16:47 soulseek.ini
-rw-r--r--    1 root     root         1521 Jan 10 19:20 stats.ini
-rw-r--r--    1 root     root         1521 Jan 10 19:13 stats.ini.old
-rw-r--r--    1 root     root        10113 Jan 10 19:20 stats_mod.ini
-rw-r--r--    1 root     root        10113 Jan 10 19:13 stats_mod.ini.old
drwxr-xr-x    5 mlnet    mlnet        2048 Jun 21  2004 torrents

spiralvoice <spiralvoice>
Group administrator
Fri 07 Jan 2005 08:16:35 AM UTC, original submission:  

If you quit mldonkey with "kill" from telnet-Interface it don't saves the *.ini files.

Stopping mldonkey by Ctrl-C or "kill mlnet" has not this bug.

Knocker <knocker>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #3013:  no-daemon-reverse.patch added by amorphous (3KiB - text/x-patch - reverse of the applied patch that removed the daemon argument)
file #2992:  no_daemon.patch added by spiralvoice (3KiB - application/octet-stream - updated version)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 18 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-06-08 spiralvoice Reassign ItemFrom group mldonkey, a multi-networks file-sharing client, bugs tracker To group mldonkey, a multi-networks file-sharing client, task tracker
2005-05-27 spiralvoice StatusFixed Postponed
    Open/ClosedClosed Open
2005-05-27 spiralvoice Severity5 - Blocker 1 - Wish
    Item GroupProgram malfunction Feature request
2005-05-27 spiralvoice Open/ClosedOpen Closed
    Release2-5-28 2.5.30.15
    Release2.5.28
    Summaryno &quot;save&quot; after &quot;kill&quot;-command start option "-daemon" does not work anymore
2005-05-27 amorphous Attached File- Added no-daemon-reverse.patch, #2548
2005-05-26 spiralvoice StatusNone Fixed
2005-05-18 spiralvoice Attached File#2506 Removed
2005-05-18 spiralvoice Attached File- Added no_daemon.patch, #2514
2005-05-17 spiralvoice Attached File- Added no_daemon.patch, #2506
2005-05-08 spiralvoice Severity3 - Normal 5 - Blocker
2005-04-01 amorphous Carbon-Copy- Added kempston
2005-03-16 amorphous StatusWorks For Me None
2005-01-10 spiralvoice StatusNone Works For Me

Back to the top

Powered by Savane 3.13-4448.
Corresponding source code