[Serdev] [Tracker] Created: (SER-210) self-shutdown deadlock when module's child_init returns -1 result value

Michal Matyska (JIRA) tracker at iptel.org
Thu Jan 18 10:33:39 UTC 2007


self-shutdown deadlock when module's child_init returns -1 result value
-----------------------------------------------------------------------

                 Key: SER-210
                 URL: http://tracker.iptel.org/browse/SER-210
             Project: SER
          Issue Type: Bug
    Affects Versions: Ottendorf
         Environment: debian, CVS HEAD
            Reporter: Michal Matyska


Change one of the modules to return -1 result from child_init call (I selected sl module, see patch)

diff -u -r1.31 sl.c
--- modules/sl/sl.c     19 Jul 2006 15:17:57 -0000      1.31
+++ modules/sl/sl.c     18 Jan 2007 10:12:32 -0000
@@ -142,10 +142,10 @@
 static int child_init(int rank)
 {
        if (rank == 1) {
-               if (init_sl_stats_child() < 0) {
+//             if (init_sl_stats_child() < 0) {
                        ERR("init_sl_stats_child failed\n");
                        return -1;
-               }
+//             }
        }
        return 0;
 }

Then start ser with the minimalistic config file:
listen=lo
loadmodule "./modules/sl/sl.so"
route{
        forward_udp("10.0.0.1");
}

When the childs are forked and child_init is called, the sl module returns -1 and the main process starts the suicide, but does not finish it.

SER output:
michal at broucek:/work/ser/HEAD$ ./ser -f ../testchldinit.cfg -ddDDE
Listening on
             udp: 127.0.0.1 [127.0.0.1]:5060
             tcp: 127.0.0.1 [127.0.0.1]:5060
Aliases:
             tcp: localhost:5060
             udp: localhost:5060

 1(19319) ERROR: sl.c:146: init_sl_stats_child failed
 1(19319) init_mod_child(): Error while initializing module sl
 1(19319) ERROR: fork_process(): init_child failed for  process 1, pid 19319, ""
 1(19319) main_loop: Cannot fork
19(19337) ERROR: receive_fd: EOF on 5
michal at broucek:/work/ser/HEAD$ ps ax | grep ser
19318 pts/0    R+     6:49 ./ser -f ../testchldinit.cfg -ddDDE
19320 pts/0    Z+     0:00 [ser] <defunct>
19321 pts/0    Z+     0:00 [ser] <defunct>
19322 pts/0    Z+     0:00 [ser] <defunct>
19323 pts/0    Z+     0:00 [ser] <defunct>
19324 pts/0    Z+     0:00 [ser] <defunct>
19325 pts/0    Z+     0:00 [ser] <defunct>
19326 pts/0    Z+     0:00 [ser] <defunct>
19327 pts/0    Z+     0:00 [ser] <defunct>
19328 pts/0    Z+     0:00 [ser] <defunct>
19329 pts/0    Z+     0:00 [ser] <defunct>
19330 pts/0    Z+     0:00 [ser] <defunct>
19331 pts/0    Z+     0:00 [ser] <defunct>
19332 pts/0    Z+     0:00 [ser] <defunct>
19333 pts/0    Z+     0:00 [ser] <defunct>
19334 pts/0    Z+     0:00 [ser] <defunct>
19335 pts/0    Z+     0:00 [ser] <defunct>
19336 pts/0    Z+     0:00 [ser] <defunct>
19337 pts/0    Z+     0:00 [ser] <defunct>
19365 pts/1    R+     0:00 grep ser

michal at broucek:/work/ser/HEAD$ gdb ser
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) attach 19318
Attaching to program: /work/ser/HEAD/ser, process 19318
Reading symbols from /lib/tls/libdl.so.2...done.
Loaded symbols for /lib/tls/libdl.so.2
Reading symbols from /lib/tls/libresolv.so.2...done.
Loaded symbols for /lib/tls/libresolv.so.2
Reading symbols from /lib/tls/libc.so.6...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /work/ser/HEAD/modules/sl/sl.so...done.
Loaded symbols for ./modules/sl/sl.so
Reading symbols from /lib/tls/libnss_files.so.2...done.
Loaded symbols for /lib/tls/libnss_files.so.2
Reading symbols from /usr/lib/libnss_db.so.2...done.
Loaded symbols for /usr/lib/libnss_db.so.2
Reading symbols from /usr/lib/libdb-4.3.so...done.
Loaded symbols for /usr/lib/libdb-4.3.so
Failed to read a valid object file image from memory.
0xb7efaaa7 in sched_yield () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7efaaa7 in sched_yield () from /lib/tls/libc.so.6
#1  0x0807ba0d in kill_all_children (signum=15) at mem/../fastlock.h:323
#2  0x0807cbb5 in handle_sigs () at main.c:598
#3  0x0807d03e in main_loop () at main.c:1085
#4  0x0807e969 in main (argc=Cannot access memory at address 0x1
) at main.c:1579


If I start ser with -ddDE then the exit is successfull (no fork mode).

If there is no -D option (fork and exit the main process) the result is little bit different:
 1(19375) ERROR: sl.c:146: init_sl_stats_child failed
 1(19375) init_mod_child(): Error while initializing module sl
 1(19375) ERROR: fork_process(): init_child failed for  process 1, pid 19375, ""
 1(19375) main_loop: Cannot fork

19374 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19375 ?        Z      0:00 [ser] <defunct>
19377 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19378 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19379 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19380 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19381 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19382 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19383 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19384 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19385 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19386 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19387 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19388 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19389 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19390 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19391 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19392 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19393 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE
19394 ?        S      0:00 ./ser -f ../testchldinit.cfg -ddE

(gdb) attach 19374
(gdb) bt
#0  0xb7ebdf21 in pause () from /lib/tls/libc.so.6
#1  0x0807d039 in main_loop () at main.c:1084
#2  0x0807e969 in main (argc=1313407092, argv=0x203a4f46) at main.c:1579


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.iptel.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the Serdev mailing list