comp.lang.ada
 help / color / mirror / Atom feed
* Problem with finalized protected object
@ 2004-07-07 10:40 Jano
  2004-07-07 10:53 ` Duncan Sands
  0 siblings, 1 reply; 7+ messages in thread
From: Jano @ 2004-07-07 10:40 UTC (permalink / raw)


Gnat 3.15p, both linux/win32.

I have a program that, when ended, gives the following error:

Execution terminated by unhandled exception
Exception name: PROGRAM_ERROR
Message: Protected Object is finalized
Call stack traceback locations:
0x8ab417b 0x8ad5d4e 0x8ad5940 0x8ad5893 0x8aab4d8

The traceback gives:

0x8ab417b at ada/rts/a-except.adb:1320
0x8ad5d4e at ada/rts/s-assert.adb:46
0x8ad5940 at ada/rts/s-assert.adb:46
0x8ad5893 at ada/rts/s-assert.adb:46
0x8aab4d8 at ada/rts/s-tasdeb.adb:76

As you can see, nothing in my code.

The situation is as follows. I have several tasks. The main body does 
nothing but wait for the other tasks to end. If I place a long delay in 
the main body after the tasks finalize, the exception isn't raised until 
the main body exits. In fact, debugging it shows that the exception 
happens when adafinal is called, someplace within.

Even if the fault is in my code, isn't that some ill behavior on Gnat's 
part? I would expect the program error to be raised when the finalized 
object gets called, nor later. Am I right?

Thanks for any comments,

A. Mosteo.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-07 10:40 Problem with finalized protected object Jano
@ 2004-07-07 10:53 ` Duncan Sands
  2004-07-07 20:27   ` Pascal Obry
  0 siblings, 1 reply; 7+ messages in thread
From: Duncan Sands @ 2004-07-07 10:53 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: Jano

> I have a program that, when ended, gives the following error:
> 
> Execution terminated by unhandled exception
> Exception name: PROGRAM_ERROR
> Message: Protected Object is finalized
> Call stack traceback locations:
> 0x8ab417b 0x8ad5d4e 0x8ad5940 0x8ad5893 0x8aab4d8

While it's most likely that your program is wrong, it is also true
that GNAT's finalization implementation is buggy: if you use (say)
valgrind to watch a program mixing tasks and controlled objects
in the right way, you quickly discover that during finalization the
run-time system is trying to use tasking structures that it has already
freed.  This leads to "interesting" behavior on program finalization.

Ciao,

Duncan.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-07 10:53 ` Duncan Sands
@ 2004-07-07 20:27   ` Pascal Obry
  2004-07-07 20:42     ` Duncan Sands
  2004-07-08 12:04     ` Jano
  0 siblings, 2 replies; 7+ messages in thread
From: Pascal Obry @ 2004-07-07 20:27 UTC (permalink / raw)



Duncan Sands <baldrick@free.fr> writes:

> While it's most likely that your program is wrong, it is also true
> that GNAT's finalization implementation is buggy: if you use (say)
> valgrind to watch a program mixing tasks and controlled objects
> in the right way, you quickly discover that during finalization the
> run-time system is trying to use tasking structures that it has already
> freed.  This leads to "interesting" behavior on program finalization.

Just curious, do you have a reproducer ? Does this has been reported to ACT ?

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-07 20:27   ` Pascal Obry
@ 2004-07-07 20:42     ` Duncan Sands
  2004-07-08 12:04     ` Jano
  1 sibling, 0 replies; 7+ messages in thread
From: Duncan Sands @ 2004-07-07 20:42 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: Pascal Obry

> Just curious, do you have a reproducer ? Does this has been reported to ACT ?

I'm trying to find a reasonably minimal example before reporting it.

All the best,

Duncan.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-07 20:27   ` Pascal Obry
  2004-07-07 20:42     ` Duncan Sands
@ 2004-07-08 12:04     ` Jano
  2004-07-08 12:15       ` Jano
  1 sibling, 1 reply; 7+ messages in thread
From: Jano @ 2004-07-08 12:04 UTC (permalink / raw)


Pascal Obry wrote:
> Duncan Sands <baldrick@free.fr> writes:
> 
> 
>>While it's most likely that your program is wrong, it is also true
>>that GNAT's finalization implementation is buggy: if you use (say)
>>valgrind to watch a program mixing tasks and controlled objects
>>in the right way, you quickly discover that during finalization the
>>run-time system is trying to use tasking structures that it has already
>>freed.  This leads to "interesting" behavior on program finalization.
> 
> Just curious, do you have a reproducer ? Does this has been reported to ACT ?

I didn't knew valgrind, but out of curiosity I tried it yesterday and 
both initialization and finalization gave accesses to deallocated memory 
  (!), see below. Related or not, I can't debug my program because gdb 
always segfaults before the main procedure is reached. This is in a 
linux 2.6.3. Under w2000 it happens the same, and in XP there are no 
problems (?).

I can't even debug a null procedure in this linux box, gdb always 
segfaults on run (gdb 5.1.1.gnat.3.15p). The gdb 6.0 non-ada runs 
somehow but hangs too somewhere...

I think Pascal alluded to Duncan when asking for a reproducer. In my 
case, my program is too big and I didn't notice when the Program_Error 
started to happen, because I don't normally run it from the console. I'm 
trying to track down the problem but for now I'm without clues to follow.

Here goes the valgrind log, frankly I don't know if these things are 
normal or not, or can be problems in valgrind, in gnat, libc or in my 
code :/

A "valgrind ls" shows the same initial problems in libc, whatever that 
means.

$ export LD_ASSUME_KERNEL=2.4.1
$ valgrind --trace-children=yes my_program

==14083== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==14083== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==14083== Using valgrind-2.0.0, a program supervision framework for 
x86-linux.
==14083== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==14083== Estimated CPU clock rate is 2836 MHz
==14083== For more details, rerun with: -v
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x402C36FA: __stpcpy (in /lib/libc-2.3.3.so)
==14083==    by 0x4026B708: (within /lib/libc-2.3.3.so)
==14083==    by 0x4026AFFF: setlocale (in /lib/libc-2.3.3.so)
==14083==    by 0x8091867: set_default_locale (in /bin/bash)
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x402C3707: __stpcpy (in /lib/libc-2.3.3.so)
==14083==    by 0x4026B708: (within /lib/libc-2.3.3.so)
==14083==    by 0x4026AFFF: setlocale (in /lib/libc-2.3.3.so)
==14083==    by 0x8091867: set_default_locale (in /bin/bash)
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x402C36FA: __stpcpy (in /lib/libc-2.3.3.so)
==14083==    by 0x4026BA65: (within /lib/libc-2.3.3.so)
==14083==    by 0x4026AFFF: setlocale (in /lib/libc-2.3.3.so)
==14083==    by 0x8091867: set_default_locale (in /bin/bash)
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x402C3707: __stpcpy (in /lib/libc-2.3.3.so)
==14083==    by 0x4026BA65: (within /lib/libc-2.3.3.so)
==14083==    by 0x4026AFFF: setlocale (in /lib/libc-2.3.3.so)
==14083==    by 0x8091867: set_default_locale (in /bin/bash)
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x402C36FA: __stpcpy (in /lib/libc-2.3.3.so)
==14083==    by 0x4026449E: (within /lib/libc-2.3.3.so)
==14083==    by 0x40263324: (within /lib/libc-2.3.3.so)
==14083==    by 0x402DD9B3: (within /lib/libc-2.3.3.so)
==14083==
==14083== Invalid read of size 1
==14083==    at 0x40011F16: strcmp (strcmp.c:39)
==14083==    by 0x400048B4: _dl_map_object_internal (dl-load.c:1766)
==14083==    by 0x4035B550: (within /lib/libc-2.3.3.so)
==14083==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14083==    Address 0xFFFFE210 is not stack'd, malloc'd or free'd
==14083==
==14083== Invalid read of size 1
==14083==    at 0x40011F16: strcmp (strcmp.c:39)
==14083==    by 0x400048B4: _dl_map_object_internal (dl-load.c:1766)
==14083==    by 0x4000C5C1: openaux (dl-deps.c:63)
==14083==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14083==    Address 0xFFFFE210 is not stack'd, malloc'd or free'd
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x4000A6AA: _dl_relocate_object_internal (do-rel.h:104)
==14083==    by 0x4035B760: (within /lib/libc-2.3.3.so)
==14083==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14083==    by 0x4035B3CA: _dl_open (in /lib/libc-2.3.3.so)
==14083==
==14083== Conditional jump or move depends on uninitialised value(s)
==14083==    at 0x4000A6F5: _dl_relocate_object_internal (do-rel.h:117)
==14083==    by 0x4035B760: (within /lib/libc-2.3.3.so)
==14083==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14083==    by 0x4035B3CA: _dl_open (in /lib/libc-2.3.3.so)
==14087== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==14087== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==14087== Using valgrind-2.0.0, a program supervision framework for 
x86-linux.
==14087== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==14083== discard syms in /usr/lib/gconv/ISO8859-15.so due to munmap()
==14083==
==14083== ERROR SUMMARY: 57 errors from 9 contexts (suppressed: 0 from 0)
==14083== malloc/free: in use at exit: 0 bytes in 0 blocks.
==14083== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==14083== For a detailed leak analysis,  rerun with: --leak-check=yes
==14083== For counts of detected errors, rerun with: -v
[jano@deepsix src]$ ==14087== Estimated CPU clock rate is 2815 MHz
==14087== For more details, rerun with: -v
==14087==
==14087== valgrind's libpthread.so: IGNORED call to: pthread_setschedparam
==14087== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
==14087== valgrind's libpthread.so: IGNORED call to: pthread_setschedparam
==14087== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
==14087== valgrind's libpthread.so: IGNORED call to: pthread_setschedparam
==14087== valgrind's libpthread.so: IGNORED call to: pthread_attr_destroy
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x847181D: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490A78: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4078)
==14087==
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x8471910: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490A78: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4078)
==14087==
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x847181D: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490AB0: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4082)
==14087==
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x8471910: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490AB0: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4082)
==14087==
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x847181D: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490AE8: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4083)
==14087==
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x847A664: sax__readers__value 
(../../xmlada/sax/sax-readers.adb:2006)
==14087==    by 0x8471910: sax__readers__add_namespace 
(../../xmlada/sax/sax-readers.adb:908)
==14087==    by 0x8471685: sax__readers__add_namespace_no_event 
(../../xmlada/sax/sax-readers.adb:892)
==14087==    by 0x8490AE8: sax__readers__parse 
(../../xmlada/sax/sax-readers.adb:4083)
[13:27:16.60] (i) Adagio 2.1.8 20040705L is starting...
==14087==
==14087== Thread 12:
==14087== Syscall param write(buf) contains uninitialised or 
unaddressable byte(s)
==14087==    at 0x40349E78: __libc_write (in /lib/i686/libc-2.3.3.so)
==14087==    by 0x402DDFFF: (within /lib/i686/libc-2.3.3.so)
==14087==    by 0x402DCAAD: _IO_do_write (in /lib/i686/libc-2.3.3.so)
==14087==    by 0x402DD10A: _IO_file_overflow (in /lib/i686/libc-2.3.3.so)
==14087==    Address 0x49F77555 is not stack'd, malloc'd or free'd
[13:31:20.22] (i) Adagio 2.1.8 20040705L started in  0h  4m  4s
==14087==
==14087== Thread 38:
==14087== Invalid read of size 1
==14087==    at 0x40011F16: strcmp (strcmp.c:39)
==14087==    by 0x400048B4: _dl_map_object_internal (dl-load.c:1766)
==14087==    by 0x4038AE40: (within /lib/i686/libc-2.3.3.so)
==14087==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14087==    Address 0xFFFFE210 is not stack'd, malloc'd or free'd
==14087==
==14087== Thread 38:
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x40011DA6: strchr (strchr.S:147)
==14087==
==14087== Thread 38:
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x40011F99: strlen (strlen.S:112)
==14087==    by 0x4038AE40: (within /lib/i686/libc-2.3.3.so)
==14087==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14087==    by 0x4038ACAE: _dl_open (in /lib/i686/libc-2.3.3.so)
==14087==
==14087== Thread 38:
==14087== Invalid read of size 1
==14087==    at 0x40011F16: strcmp (strcmp.c:39)
==14087==    by 0x400048B4: _dl_map_object_internal (dl-load.c:1766)
==14087==    by 0x4000C5C1: openaux (dl-deps.c:63)
==14087==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14087==    Address 0xFFFFE210 is not stack'd, malloc'd or free'd
==14087==
==14087== Thread 38:
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x4000A6AA: _dl_relocate_object_internal (do-rel.h:104)
==14087==    by 0x4038B07C: (within /lib/i686/libc-2.3.3.so)
==14087==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14087==    by 0x4038ACAE: _dl_open (in /lib/i686/libc-2.3.3.so)
==14087==
==14087== Thread 38:
==14087== Conditional jump or move depends on uninitialised value(s)
==14087==    at 0x4000A6F5: _dl_relocate_object_internal (do-rel.h:117)
==14087==    by 0x4038B07C: (within /lib/i686/libc-2.3.3.so)
==14087==    by 0x4000CB87: _dl_catch_error_internal (dl-error.c:162)
==14087==    by 0x4038ACAE: _dl_open (in /lib/i686/libc-2.3.3.so)

*** AT THIS POINT MY PROGRAM STARTS TO FINALIZE ***

[13:31:56.41] (i) G2.Listener_task exited
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x86B7417: adagio__socket__close 
(../network/adagio-socket.adb:168)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)
==14087==    Address 0x47D656E0 is 4 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x86B7580: adagio__socket__close 
(../network/adagio-socket.adb:169)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)
==14087==    Address 0x48D66E40 is 0 bytes inside a block of size 8 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B762D: adagio__socket__close 
(../network/adagio-socket.adb:169)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid free() / delete / delete[]
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B762D: adagio__socket__close 
(../network/adagio-socket.adb:169)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    Address 0x48D66E40 is 0 bytes inside a block of size 8 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B762D: adagio__socket__close 
(../network/adagio-socket.adb:169)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x86B77A3: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)
==14087==    Address 0x47D656DC is 0 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5504: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656EC is 16 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD550A: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656E8 is 12 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5517: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656EC is 16 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD551A: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656E8 is 12 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5520: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656E8 is 12 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5523: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656EC is 16 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid write of size 4
==14087==    at 0x8AD5526: 
system__finalization_implementation__detach_from_final_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD572E: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D65C9C is 16 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934C58: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:107)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5732: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    Address 0x47D656E4 is 8 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5552: system__finalization_implementation__finalize 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AD573C: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B7813: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    Address 0x47D656F0 is 20 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD5656: 
system__finalization_implementation__finalize_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD555A: system__finalization_implementation__finalize 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AD573C: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    Address 0x47D65700 is 36 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x8AD565F: 
system__finalization_implementation__finalize_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD555A: system__finalization_implementation__finalize 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AD573C: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x86B6339: adagio__socket___deep_finalize__4 (in 
/home/jano/adagio/src/adagio)
==14087==    Address 0x47D656F8 is 28 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x84CF793: adagio__debug__finalize__2 
(../kernel/adagio-debug.adb:80)
==14087==    by 0x8AD5666: 
system__finalization_implementation__finalize_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD555A: system__finalization_implementation__finalize 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AD573C: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    Address 0x47D65704 is 40 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid read of size 4
==14087==    at 0x84CF79C: adagio__debug__finalize__2 
(../kernel/adagio-debug.adb:80)
==14087==    by 0x8AD5666: 
system__finalization_implementation__finalize_list (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AD555A: system__finalization_implementation__finalize 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AD573C: 
system__finalization_implementation__finalize_one (in 
/home/jano/adagio/src/adagio)
==14087==    Address 0x47D65708 is 44 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
==14087==
==14087== Thread 39:
==14087== Invalid free() / delete / delete[]
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8936F00: adagio__g2__listener__accepter_taskB 
(../g2/adagio-g2-listener.adb:218)
==14087==    Address 0x47D656DC is 0 bytes inside a block of size 48 free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x86B7833: adagio__socket__close 
(../network/adagio-socket.adb:171)
==14087==    by 0x8934908: 
adagio__g2__listener__listener_task__disconnect.7 
(../g2/adagio-g2-listener.adb:100)
[13:31:56.87] (i) G2.Accepter_task exited
[13:31:56.89] (i) G2.Core.Sender_udp exited
==14087== valgrind's libpthread.so: KLUDGED call to: pthread_cond_destroy
==14087== valgrind's libpthread.so: KLUDGED call to: pthread_cond_destroy
==14087== valgrind's libpthread.so: KLUDGED call to: pthread_cond_destroy
==14087==
==14087== Thread 33:
==14087== Invalid read of size 4
==14087==    at 0x8AD92B5: _gnat_stack_check (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x83C33CF: aws__server__stop_log 
(../../aws/src/aws-server.adb:1003)
==14087==    by 0x83BB582: aws__server__shutdown 
(../../aws/src/aws-server.adb:516)
==14087==    by 0x8A919FC: adagio__gui__shutdown (../gui/adagio-gui.adb:115)
==14087==    Address 0x490DB728 is 88 bytes inside a block of size 1716 
free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x8AAB352: system__tasking__stages__free_task (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x80BF5A5: aws__session__control__shutdown 
(../../aws/src/aws-session-control.adb:64)
==14087==
==14087== Thread 33:
==14087== Invalid read of size 4
==14087==    at 0x8AD92BB: _gnat_stack_check (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x83C33CF: aws__server__stop_log 
(../../aws/src/aws-server.adb:1003)
==14087==    by 0x83BB582: aws__server__shutdown 
(../../aws/src/aws-server.adb:516)
==14087==    by 0x8A919FC: adagio__gui__shutdown (../gui/adagio-gui.adb:115)
==14087==    Address 0x490DB724 is 84 bytes inside a block of size 1716 
free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x8AAB352: system__tasking__stages__free_task (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x80BF5A5: aws__session__control__shutdown 
(../../aws/src/aws-session-control.adb:64)
[13:32:04.93] (i) Adagio exited

*** AT THIS POINT THERE'S ONLY THE MAIN TASK RUNNING AND NO CODE REMAINS
*** TO BE EXECUTED

==14087==
==14087== Thread 7:
==14087== Invalid read of size 4
==14087==    at 0x8AD92B5: _gnat_stack_check (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x85ACFFB: 
adagio__connect__peer_manager__event_queue__workerBXnn 
(../tasking/generic_event_queue.ads:109)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)
==14087==    Address 0x42EF1448 is 88 bytes inside a block of size 1708 
free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x8AAC189: system__tasking__stages__vulnerable_free_task 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AAC013: 
system__tasking__stages__vulnerable_complete_master (in 
/home/jano/adagio/src/adagio)
==14087==
==14087== Thread 7:
==14087== Invalid read of size 4
==14087==    at 0x8AD92BB: _gnat_stack_check (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x85ACFFB: 
adagio__connect__peer_manager__event_queue__workerBXnn 
(../tasking/generic_event_queue.ads:109)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)
==14087==    Address 0x42EF1444 is 84 bytes inside a block of size 1708 
free'd
==14087==    at 0x4002AF19: free (vg_replace_malloc.c:231)
==14087==    by 0x8ADA814: __gnat_free (s-memory.adb:110)
==14087==    by 0x8AAC189: system__tasking__stages__vulnerable_free_task 
(in /home/jano/adagio/src/adagio)
==14087==    by 0x8AAC013: 
system__tasking__stages__vulnerable_complete_master (in 
/home/jano/adagio/src/adagio)
==14087==
==14087== Thread 4:
==14087== pthread_kill: invalid target thread
==14087==    at 0x40238435: pthread_kill (vg_libpthread.c:1306)
==14087==    by 0x8AA1061: system__interrupts__server_taskB (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x8AAB621: system__tasking__stages__task_wrapper (in 
/home/jano/adagio/src/adagio)
==14087==    by 0x40237584: thread_wrapper (vg_libpthread.c:667)

Execution terminated by unhandled exception
Exception name: PROGRAM_ERROR
Message: Protected Object is finalized
Call stack traceback locations:
0x8ab3e5b 0x8ad5a2e 0x8ad5620 0x8ad5573 0x8aab1b8
==14087== discard syms in /lib/libnss_files-2.3.3.so due to munmap()
==14087==
==14087== ERROR SUMMARY: 61 errors from 36 contexts (suppressed: 5 from 2)
==14087== malloc/free: in use at exit: 373116 bytes in 2828 blocks.
==14087== malloc/free: 315373 allocs, 312547 frees, 16830409 bytes 
allocated.
==14087== For a detailed leak analysis,  rerun with: --leak-check=yes
==14087== For counts of detected errors, rerun with: -v



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-08 12:04     ` Jano
@ 2004-07-08 12:15       ` Jano
  2004-07-08 13:29         ` Duncan Sands
  0 siblings, 1 reply; 7+ messages in thread
From: Jano @ 2004-07-08 12:15 UTC (permalink / raw)


Jano wrote:

> I can't even debug a null procedure in this linux box, gdb always 
> segfaults on run (gdb 5.1.1.gnat.3.15p). The gdb 6.0 non-ada runs 
> somehow but hangs too somewhere...

Correction: gdb 6.0 doesn't hang, I had forgotten the LD_ASSUME_KERNEL 
export.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem with finalized protected object
  2004-07-08 12:15       ` Jano
@ 2004-07-08 13:29         ` Duncan Sands
  0 siblings, 0 replies; 7+ messages in thread
From: Duncan Sands @ 2004-07-08 13:29 UTC (permalink / raw)
  To: comp.lang.ada; +Cc: Jano

On Thursday 08 July 2004 14:15, Jano wrote:
> Jano wrote:
> 
> > I can't even debug a null procedure in this linux box, gdb always 
> > segfaults on run (gdb 5.1.1.gnat.3.15p). The gdb 6.0 non-ada runs 
> > somehow but hangs too somewhere...
> 
> Correction: gdb 6.0 doesn't hang, I had forgotten the LD_ASSUME_KERNEL 
> export.

If you pass (for example) --num-callers=20 to valgrind, then you get bigger
backtraces, which may be helpful.

Ciao,

Duncan.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-08 13:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-07 10:40 Problem with finalized protected object Jano
2004-07-07 10:53 ` Duncan Sands
2004-07-07 20:27   ` Pascal Obry
2004-07-07 20:42     ` Duncan Sands
2004-07-08 12:04     ` Jano
2004-07-08 12:15       ` Jano
2004-07-08 13:29         ` Duncan Sands

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox