Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: CleverFool on August 07, 2005, 12:29:57 pm

Title: Segmentation fault when calling code completion plugin in RC1-1
Post by: CleverFool on August 07, 2005, 12:29:57 pm
I get segmentation fault every time I'm calling code completion plugin in RC1-1. It is when I go to Settings->Plugins' settings->Code completion or just press Ctrl-Space somewhere in editor Code::Blocks just crashes with "Segmentation fault when calling code completion plugin in RC1-1".

Here is what gdb says when code completion setting are called:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230808144 (LWP 9840)]
0xb7e11cfb in wxThreadInternal::PthreadStart () from /usr/lib/libwx_gtk2-2.4.so

And backtrace:

#0  0xb7e11cfb in wxThreadInternal::PthreadStart () from /usr/lib/libwx_gtk2-2.4.so
#1  0xb7e11ecc in wxPthreadStart () from /usr/lib/libwx_gtk2-2.4.so
#2  0xb778bccd in start_thread () from /lib/tls/libpthread.so.0
#3  0xb771eb0e in clone () from /lib/tls/libc.so.6

When I disable code completion - codeblocks works without glitches, however I want code completion too:)
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: rickg22 on August 07, 2005, 04:47:50 pm
Um, isn't there a #4 in the backtrace? I see nothing related to Code::blocks in there :?
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: Game_Ender on August 08, 2005, 03:31:39 am
I get the same backtrace I believe.  My guess is the error has nothing to do with libc.  Like a lot of seg faults the place where it comes up is not necessarily the place where the error is caused.  For example, some random function some where could set a pointer to NULL, and then in another place you try access it, getting a segfault.  Sorry to sound like a broken record, but you should give valgrind (http://www.valgrind.org) a try.  I believe when I tried it a couple of days ago, codeblocks actually crashed valgrind before I was able to get to test that exact error.  That was with 2.3 or 2.4, the new version might do better.
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: rickg22 on August 08, 2005, 06:50:34 am
We have to investigate more about this.
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: rickg22 on August 12, 2005, 08:50:28 am
I realized the cause... apparently, A lot of threads get created before they can even be destroyed. This means, that in Linux, thread creation does _NOT_ obey the maximum number of threads limited.

So, in plain terms, this whole thread business has to be reengineered. What I'm going to do, is NOT deleteing the threads when they finish their job. Instead, they're moved back into the "available threads" store, so they can perform their job, without having to create new threads. I really hope this can get rid of all the codecompletion crashing.

Oh, I realized why it crashes on config. It creates sample classes by doing a "mini-parsing" stage. This triggers the problem again, and the crashes happen.
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: BEEjay on August 25, 2005, 02:23:26 pm
Hi i've the same problem too  :(. Did anyone solved this problem?


Many thx for any help.
Title: Re: Segmentation fault when calling code completion plugin in RC1-1
Post by: mandrav on August 25, 2005, 02:46:23 pm
Hi i've the same problem too  :(. Did anyone solved this problem?


Many thx for any help.

Yes, it's fixed in CVS (branch VERSION_1_0).

Yiannis.