valgrind is a useful tool to find memory corruption.

Try the attached patch.

Jean-Louis

On 10/02/17 09:35 AM, Jean-Francois Malouin wrote:
> * Jean-Louis Martineau <jmartin...@carbonite.com> [20170210 07:54]:
>> Jean-Francois,
>>
>> I was not able to find the problem with the stacktrace.
>>
>> Do you have valgrind installed on your system?, if yes, can you run the
>> following command:
>> G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --trace-children=yes
>> --log-file=valgrind.amtape.output --leak-check=full
>> --leak-resolution=high --track-origins=yes amadmin top tape
>>
>> And send me the resulting valgrind.amtape.output file.
> The output from valgrind file is attached.
>
> cheers,
> jf
>
>> Jean-Louis
>>
>> On 09/02/17 02:19 PM, Jean-Francois Malouin wrote:
>>> * Jean-Louis Martineau <jmartin...@carbonite.com> [20170209 14:09]:
>>>> Jean-Francois,
>>>>
>>>> Can you run amadmin in gdb and get a stacktrace?
>>>>
>>>> $ gdb ~amanda/sbin/amadmin
>>>> (gdb) run top tape
>>>> (gdb) bt
>>>> (gdb) quit
>>>>
>>>> Jean-Louis
>>> Here you go:
>>>
>>> amanda@dow:~$ gdb ~amanda/sbin/amadmin
>>> GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
>>> Copyright (C) 2014 Free Software Foundation, Inc.
>>> License GPLv3+: GNU GPL version 3 or later
>>> <http://gnu.org/licenses/gpl.html>
>>> This is free software: you are free to change and redistribute it.
>>> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>>> and "show warranty" for details.
>>> This GDB was configured as "x86_64-linux-gnu".
>>> Type "show configuration" for configuration details.
>>> For bug reporting instructions, please see:
>>> <http://www.gnu.org/software/gdb/bugs/>.
>>> Find the GDB manual and other documentation resources online at:
>>> <http://www.gnu.org/software/gdb/documentation/>.
>>> For help, type "help".
>>> Type "apropos word" to search for commands related to "word"...
>>> Reading symbols from /opt/amanda/sbin/amadmin...(no debugging symbols
>>> found)...done.
>>> (gdb) run top tape
>>> Starting program: /opt/amanda-3.4.2/sbin/amadmin top tape
>>> [Thread debugging using libthread_db enabled]
>>> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>>> The next Amanda should go onto 3 new tapes.
>>> *** Error in `/opt/amanda-3.4.2/sbin/amadmin': corrupted double-linked 
>>> list: 0x00000000006f4710 ***
>>> The next 3 new tapes already labelled are: NEO-T48-B00022,
>>> NEO-T48-B00023, NEO-T48-B00024
>>> Program received signal SIGABRT, Aborted.
>>> 0x00007ffff50ee067 in __GI_raise (sig=sig@entry=6) at 
>>> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
>>> 56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
>>> (gdb) bt
>>> #0  0x00007ffff50ee067 in __GI_raise (sig=sig@entry=6) at 
>>> ../nptl/sysdeps/unix/sysv/linux/raise.c:56
>>> #1  0x00007ffff50ef448 in __GI_abort () at abort.c:89
>>> #2  0x00007ffff512c1b4 in __libc_message (do_abort=do_abort@entry=1, 
>>> fmt=fmt@entry=0x7ffff5221210 "*** Error in `%s': %s: 0x%s ***\n") at 
>>> ../sysdeps/posix/libc_fatal.c:175
>>> #3  0x00007ffff513198e in malloc_printerr (action=1, str=0x7ffff521d2ec 
>>> "corrupted double-linked list", ptr=<optimized out>) at malloc.c:4996
>>> #4  0x00007ffff5131c4c in malloc_consolidate (av=av@entry=0x7ffff545e620 
>>> <main_arena>) at malloc.c:4165
>>> #5  0x00007ffff5132e98 in _int_malloc (av=0x7ffff545e620 <main_arena>, 
>>> bytes=32816) at malloc.c:3423
>>> #6  0x00007ffff5135020 in __GI___libc_malloc (bytes=32816) at malloc.c:2891
>>> #7  0x00007ffff516ee31 in __alloc_dir (fd=3, close_fd=<optimized out>, 
>>> flags=<optimized out>, statp=<optimized out>) at 
>>> ../sysdeps/posix/opendir.c:207
>>> #8  0x00007ffff74a5d19 in debug_unlink_old () from 
>>> /opt/amanda/lib/amanda/libamanda-3.4.2.so
>>> #9  0x00007ffff74a6cf2 in debug_close () from 
>>> /opt/amanda/lib/amanda/libamanda-3.4.2.so
>>> #10 0x00000000004038b7 in main ()
>>> (gdb) quit
>>> A debugging session is active.
>>>
>>>       Inferior 1 [process 4173] will be killed.
>>>
>>> Quit anyway? (y or n) y
>>>
>>> cheers,
>>> jf
>>>
>>>> On 09/02/17 01:56 PM, Jean-Francois Malouin wrote:
>>>>> * Stefan G. Weichinger <s...@amanda.org> [20170209 13:36]:
>>>>>> Does anyone use amanda 3.4.2 packages on debian jessie already?
>>>>>> Which one, do they work?
>>>>> I only see amanda 3.3.6 on Debian/Jessie stable repos at the moment:
>>>>>
>>>>> Inst amanda-common (1:3.3.6-4 Debian:8.7/stable [amd64])
>>>>> Inst amanda-server (1:3.3.6-4 Debian:8.7/stable [amd64])
>>>>> Inst amanda-client (1:3.3.6-4 Debian:8.7/stable [amd64])
>>>>>
>>>>> I've been running a self-compiled amanda-3.4.1 on a Jessie host for a
>>>>> month now with little problems so far, except this
>>>>>
>>>>> :~# su amanda -c "~amanda/sbin/amadmin top tape"
>>>>> The next Amanda should go onto 3 new tapes.
>>>>> *** Error in `/opt/amanda/sbin/amadmin': corrupted double-linked list: 
>>>>> 0x0000000001153710 ***
>>>>> The next 3 new tapes already labelled are: NEO-T48-B00022, 
>>>>> NEO-T48-B00023, NEO-T48-B00024
>>>>>
>>>>> I have seen this on 3.4.1 and 3.4.2 (I just upgraded).
>>>>>
>>>>> cheers,
>>>>> jf
>>>>>
>>>>>
>>>>>> I have to switch OS on a backup server and want to stay with
>>>>>> amanda-3.4.x because I need some of the latest features ...
>>>>>>
>>>>>> self-compile, you know ... I can do but I'd like to avoid.
>>>>>> lower maintenance.
diff --git a/server-src/amadmin.c b/server-src/amadmin.c
index 4c25e87..3653bab 100644
--- a/server-src/amadmin.c
+++ b/server-src/amadmin.c
@@ -774,16 +774,13 @@ tape(
 	    }
 	    if (c == 1) {
 		printf("The next new tape already labelled is: %s.", *tapes);
-		g_free(*tapes);
 	    } else {
 		printf("The next %d new tapes already labelled are: %s",
 			c, *tapes);
-		g_free(*tapes);
 		tape = tapes;
 		tape++;
 		while (*tape != NULL) {
 		    printf(", %s", *tape);
-		    g_free(*tape);
 		    tape++;
 		}
 	    }

Reply via email to