After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 652528 - LinkedList causes stack overflow during freeing with large number of elements
LinkedList causes stack overflow during freeing with large number of elements
Status: RESOLVED FIXED
Product: libgee
Classification: Platform
Component: general
0.6.x
Other Mac OS
: High critical
: ---
Assigned To: libgee-maint
libgee-maint
: 652523 652527 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-06-14 07:56 UTC by Serge Hulne
Modified: 2011-06-15 08:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Serge Hulne 2011-06-14 07:56:16 UTC
Example:

The snippet hereunder works with a number of elements equal to 100,000 but crashes with a number of elements equal to 1000,000.

Serge Hulne   


// ---
using Gee;
using Posix;




int main(string[] args) {
 
    //List
    var L = new LinkedList<int>();
    
    // Insert in List     
    for (var i=0; i<1000000; i++) {
        L.add(1);
    }

    return 0;
}        

// ---
Comment 1 Serge Hulne 2011-06-14 08:25:51 UTC
More generally the tests shipped with the library should contain tests for insertion of large number of elements for all the containers (list, map, etc ...)
Comment 2 Maciej (Matthew) Piechotka 2011-06-14 09:17:55 UTC
*** Bug 652523 has been marked as a duplicate of this bug. ***
Comment 3 Maciej (Matthew) Piechotka 2011-06-14 09:18:02 UTC
*** Bug 652527 has been marked as a duplicate of this bug. ***
Comment 4 Maciej (Matthew) Piechotka 2011-06-14 09:20:46 UTC
Thanks for taking the time to report this bug.
Without a stack trace from the crash it's very hard to determine what caused it.
Can you get us a stack trace? Please see http://live.gnome.org/GettingTraces for more information on how to do so. Thanks in advance!

PS. I will try to reproduce it today evening however the stacktrace can be most helpful. Also - what's your version of libgee, vala etc.
Comment 5 Serge Hulne 2011-06-14 10:05:51 UTC
Libgee version : 0.6
Vala version : 0.12
Hardware : Mac Mini pentium dual core


I am running this test under Mac OS 10.6 so I do not know how to get a trace tehe Linux way under Mac, however here is the output of gdb:


Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff8
0x000000010014e0d5 in gee_linked_list_node_free (self=0x1019c18c0) at linkedlist.c:1183
1183		_gee_linked_list_node_free0 (self->next);
(gdb) 


If needed, I can duplicate this test under Linux by the end of the week to get the required trace.
Comment 6 Maciej (Matthew) Piechotka 2011-06-14 10:08:57 UTC
(In reply to comment #5)
> Libgee version : 0.6
> Vala version : 0.12
> Hardware : Mac Mini pentium dual core
> 
> 
> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff8
> 0x000000010014e0d5 in gee_linked_list_node_free (self=0x1019c18c0) at
> linkedlist.c:1183
> 1183        _gee_linked_list_node_free0 (self->next);
> (gdb) 
> 

Could you send the output of "bt full"?
Comment 7 Serge Hulne 2011-06-14 11:20:39 UTC
The output of bt full (from gdb) is:

  • #5610 gee_linked_list_node_free
    at linkedlist.c line 1183

...

(repeated over and over)

Serge.
Comment 8 Maciej (Matthew) Piechotka 2011-06-14 11:23:14 UTC
I was thinking where the value come from. IMHO it looks like stack overflow. I don't have time right now to fix it but I will do this this afternoon.
Comment 9 Maciej (Matthew) Piechotka 2011-06-15 07:22:11 UTC
(In reply to comment #5)
> Libgee version : 0.6

Have you tried 0.6.1? What about current git version?

> Vala version : 0.12
> Hardware : Mac Mini pentium dual core
> 
> 
> I am running this test under Mac OS 10.6 so I do not know how to get a trace
> tehe Linux way under Mac, however here is the output of gdb:
> 

1. compile with -g or -gdb flag
2. don't strip

---------------------------

Unfortunatly I cannot reproduce it on Linux. It works with 10000000 and I get OOM on 100000000 (counting 12B of overhead 12B*100000000 = 1200000000B = 1200000kB = 1200MB = 1.2 GB < 1.2 GiB - strange that 4GiB machine cannot handle it).

It is not stackflow overflow after looking on code. I'll try to get some Mac OS machine (borrow from friend etc.)
Comment 10 Maciej (Matthew) Piechotka 2011-06-15 07:28:13 UTC
The bug was fixed in 0.6.1 (looking on code) assuming it was the stack overflow. If you still get the problem on 0.6.1 please feel free to reopen the bug.
Comment 11 Serge Hulne 2011-06-15 08:26:21 UTC
libgee version 0.6.1 seems to work indeed.


I had been using version 0.6.0 instead, because the link on the libgee homepage:

http://live.gnome.org/Libgee

points to version 0.6.0 instead of pointing to version 0.6.1



Thanks,
Serge.